home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / obrn-a_1.5_lib.lha / oberon-a / source1.lha / source / amiga / Dos.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  82.3 KB  |  2,459 lines

  1. (*************************************************************************
  2.  
  3.      $RCSfile: Dos.mod $
  4.   Description: Interface to dos.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.7 $
  8.       $Author: fjc $
  9.         $Date: 1995/01/26 02:39:55 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. *************************************************************************)
  21.  
  22. <* STANDARD- *> <* INITIALISE- *> <* MAIN- *>
  23. <*$ CaseChk-  IndexChk- LongVars+ NilChk-  *>
  24. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  25.  
  26. MODULE [2] Dos;
  27.  
  28. IMPORT
  29.   SYS := SYSTEM, Kernel, e := Exec, t := Timer, u := Utility,
  30.   s := Sets;
  31.  
  32.  
  33. (**-- Pointer declarations ---------------------------------------------*)
  34.  
  35. TYPE
  36.  
  37.   DatePtr*                  = POINTER TO Date;
  38.   FileInfoBlockPtr*         = POINTER TO FileInfoBlock;
  39.   InfoDataPtr*              = POINTER TO InfoData;
  40.   DateTimePtr*              = POINTER TO DateTime;
  41.   AChainPtr*                = POINTER TO AChain;
  42.   AnchorPathPtr*            = POINTER TO AnchorPath;
  43.   DosEnvecPtr*              = POINTER [3] TO DosEnvec;
  44.   FileSysStartupMsgPtr*     = POINTER [3] TO FileSysStartupMsg;
  45.   DeviceNodePtr*            = POINTER TO DeviceNode;
  46.   NotifyRequestPtr*         = POINTER TO NotifyRequest;
  47.   NotifyMessagePtr*         = POINTER TO NotifyMessage;
  48.   CSourcePtr*               = POINTER TO CSource;
  49.   RDArgsPtr*                = POINTER TO RDArgs;
  50.   RecordLockPtr*            = POINTER TO RecordLock;
  51.   LocalVarPtr*              = POINTER TO LocalVar;
  52.   ExAllDataPtr*             = POINTER TO ExAllData;
  53.   ExAllControlPtr*          = POINTER TO ExAllControl;
  54.   ProcessPtr*               = POINTER TO Process;
  55.   FileHandlePtr*            = POINTER [3] TO FileHandle;
  56.   DosPacketPtr*             = POINTER TO DosPacket;
  57.   StandardPacketPtr*        = POINTER TO StandardPacket;
  58.   TaskArrayPtr*             = POINTER [3] TO TaskArray;
  59.   RootNodePtr*              = POINTER TO RootNode;
  60.   ErrorStringPtr*           = POINTER TO ErrorString;
  61.   DosLibraryPtr*            = POINTER TO DosLibrary;
  62.   CliProcListPtr*           = POINTER TO CliProcList;
  63.   DosInfoPtr*               = POINTER [3] TO DosInfo;
  64.   SegmentPtr*               = POINTER TO Segment;
  65.   CommandLineInterfacePtr*  = POINTER [3] TO CommandLineInterface;
  66.   DeviceListPtr*            = POINTER [3] TO DeviceList;
  67.   DevInfoPtr*               = POINTER [3] TO DevInfo;
  68.   AssignListPtr*            = POINTER TO AssignList;
  69.   DosListPtr*               = POINTER [3] TO DosList;
  70.   DevProcPtr*               = POINTER TO DevProc;
  71.   FileLockPtr*              = POINTER [3] TO FileLock;
  72.   ProcessId*                = e.MsgPortPtr; (* Points to Process.msgPort *)
  73.   DosListNodePtr*           = POINTER TO DosListNode;
  74.  
  75. (*
  76. **      $VER: dos.h 36.27 (5.4.92)
  77. **
  78. **      Standard header for AmigaDOS
  79. *)
  80.  
  81. CONST
  82.  
  83.   dosName * = "dos.library";
  84.  
  85. (* Predefined Amiga DOS global constants *)
  86.  
  87.   DOSTRUE * = e.LTRUE;
  88.   DOSFALSE * = e.LFALSE;
  89.  
  90. (* Mode parameter to Open() *)
  91.   oldFile        * = 1005;   (* Open existing file read/write
  92.                               * positioned at beginning of file. *)
  93.   newFile        * = 1006;   (* Open freshly created file (delete
  94.                               * old file) read/write, exclusive lock. *)
  95.   readWrite      * = 1004;   (* Open old file w/shared lock,
  96.                               * creates file if doesn't exist. *)
  97.  
  98. (* Relative position to Seek() *)
  99.   beginning    * = -1;      (* relative to Begining Of File *)
  100.   current      * =  0;      (* relative to Current file position *)
  101.   end          * =  1;      (* relative to End Of File    *)
  102.  
  103.   bitsPerByte         * = 8;
  104.   bytesPerLong        * = 4;
  105.   bitsPerLong         * = 32;
  106.   maxInt              * = 7FFFFFFFH;
  107.   minInt              * = 80000000H;
  108.  
  109. (* Passed as type to Lock() *)
  110.   sharedLock         * = -2;     (* File is readable by others *)
  111.   accessRead         * = -2;     (* Synonym *)
  112.   exclusiveLock      * = -1;     (* No other access allowed    *)
  113.   accessWrite        * = -1;     (* Synonym *)
  114.  
  115. TYPE
  116.  
  117. (*
  118. ** Note that the type name has been changed from DateStamp to Date to
  119. ** avoid a name clash with the DateStamp() function.
  120. *)
  121.  
  122.   DateBase *= RECORD END;
  123.   DateBasePtr *= POINTER TO DateBase;
  124.  
  125.   Date* = RECORD (DateBase)
  126.     days  * : LONGINT;           (* Number of days since Jan. 1, 1978 *)
  127.     minute* : LONGINT;           (* Number of minutes past midnight *)
  128.     tick  * : LONGINT;           (* Number of ticks past minute *)
  129.   END; (* Date *)
  130.  
  131. CONST
  132.  
  133.   ticksPerSecond     * = 50;   (* Number of ticks in one second *)
  134.  
  135. TYPE
  136.  
  137. (* Returned by Examine() and ExNext(), must be on a 4 byte boundary *)
  138.   FileInfoBlock* = RECORD
  139.     diskKey     * : LONGINT;
  140.     dirEntryType* : LONGINT;
  141.                             (* Type of Directory. If < 0, then a plain file.
  142.                              * If > 0 a directory *)
  143.     fileName    * : ARRAY 108 OF CHAR;
  144.                             (* Null terminated. Max 30 chars used for now *)
  145.     protection  * : s.SET32;(* bit mask of protection, rwxd are 3-0.      *)
  146.     entryType   * : LONGINT;
  147.     size        * : LONGINT;    (* Number of bytes in file *)
  148.     numBlocks   * : LONGINT;    (* Number of blocks in file *)
  149.     date        * : Date;  (* Date file last changed *)
  150.     comment     * : ARRAY 80 OF CHAR;
  151.                           (* Null terminated comment associated with file *)
  152.  
  153.     (* Note: the following fields are not supported by all filesystems.  *)
  154.     (* They should be initialized to 0 sending an ACTION_EXAMINE packet. *)
  155.     (* When Examine() is called, these are set to 0 for you.             *)
  156.     (* AllocDosObject() also initializes them to 0.                      *)
  157.     ownerUID    * : e.UWORD;      (* owner's UID *)
  158.     ownerGID    * : e.UWORD;      (* owner's GID *)
  159.  
  160.     reserved    * :  ARRAY 32 OF CHAR;
  161.   END; (* FileInfoBlock *)
  162.  
  163. CONST
  164.  
  165. (* fib stands for FileInfoBlock *)
  166.  
  167. (* Bit definitions *)
  168. (* Regular RWED bits are 0 == allowed. *)
  169. (* NOTE: GRP and OTR RWED permissions are 0 == not allowed! *)
  170. (* Group and Other permissions are not directly handled by the filesystem *)
  171.   otrRead    * = 15;       (* Other: file is readable *)
  172.   otrWrite   * = 14;       (* Other: file is writable *)
  173.   otrExecute * = 13;       (* Other: file is executable *)
  174.   otrDelete  * = 12;       (* Other: prevent file from being deleted *)
  175.   grpRead    * = 11;       (* Group: file is readable *)
  176.   grpWrite   * = 10;       (* Group: file is writable *)
  177.   grpExecute * = 9;        (* Group: file is executable *)
  178.   grpDelete  * = 8;        (* Group: prevent file from being deleted *)
  179.  
  180.   script     * = 6;        (* program is a script (execute) file *)
  181.   pure       * = 5;        (* program is reentrant and rexecutable *)
  182.   archive    * = 4;        (* cleared whenever file is changed *)
  183.   readProt   * = 3;        (* ignored by old filesystem *)
  184.   writeProt  * = 2;        (* ignored by old filesystem *)
  185.   execute    * = 1;        (* ignored by system, used by Shell *)
  186.   delete     * = 0;        (* prevent file from being deleted *)
  187.  
  188. (* Standard maximum length for an error string from fault.  However, most *)
  189. (* error strings should be kept under 60 characters if possible.  Don't   *)
  190. (* forget space for the header you pass in. *)
  191.   faultMax      * = 82;
  192.  
  193. TYPE
  194.  
  195. (* All BCPL data must be long word aligned.  BCPL pointers are the long word
  196.  *  address (i.e byte address divided by 4 (>>2)) *)
  197.  
  198.   BPTR* = SYS.BPTR;                         (* Long word pointer *)
  199.   BSTR* = POINTER [3] TO ARRAY 256 OF CHAR; (* Long word pointer to BCPL string *)
  200.  
  201. (* BCPL strings have a length in the first byte and then the characters.
  202.  * For example:  s[0]=3 s[1]=S s[2]=Y s[3]=S                             *)
  203.  
  204. (* returned by Info(), must be on a 4 byte boundary *)
  205.   InfoData* = RECORD
  206.     numSoftErrors* : LONGINT;      (* number of soft errors on disk *)
  207.     unitNumber   * : LONGINT;      (* Which unit disk is (was) mounted on *)
  208.     diskState    * : LONGINT;      (* See defines below *)
  209.     numBlocks    * : LONGINT;      (* Number of blocks on disk *)
  210.     numBlocksUsed* : LONGINT;      (* Number of block in use *)
  211.     bytesPerBlock* : LONGINT;
  212.     diskType     * : LONGINT;      (* Disk Type code *)
  213.     volumeNode   * : DeviceListPtr;(* BCPL pointer to volume node *)
  214.     inUse        * : LONGINT;      (* Flag, zero if not in use *)
  215.   END; (* InfoData *)
  216.  
  217. CONST
  218.  
  219. (* id stands for InfoData *)
  220.         (* Disk states *)
  221.   writeProtect * = 80;    (* Disk is write protected *)
  222.   validating   * = 81;    (* Disk is currently being validated *)
  223.   validated    * = 82;    (* Disk is consistent and writeable *)
  224.  
  225.         (* Disk types *)
  226. (* idInter* use international case comparison routines for hashing *)
  227.   noDiskPresent      * = -1;
  228.   unreadableDisk     * = 42414400H;   (* 'BAD\0' *)
  229.   dosDisk            * = 444F5300H;   (* 'DOS\0' *)
  230.   ffsDisk            * = 444F5301H;   (* 'DOS\1' *)
  231.   interDosDisk       * = 444F5302H;   (* 'DOS\2' *)
  232.   interFfsDisk       * = 444F5303H;   (* 'DOS\3' *)
  233.   notReallyDos       * = 4E444F53H;   (* 'NDOS'  *)
  234.   kickstartDisk      * = 4B49434BH;   (* 'KICK'  *)
  235.   msdosDisk          * = 4D534400H;   (* 'MSD\0' *)
  236.  
  237. (* Errors from IoErr(), etc. *)
  238.   noFreeStore              * = 103;
  239.   taskTableFull            * = 105;
  240.   badTemplate              * = 114;
  241.   badNumber                * = 115;
  242.   requiredArgMissing       * = 116;
  243.   keyNeedsArg              * = 117;
  244.   tooManyArgs              * = 118;
  245.   unmatchedQuotes          * = 119;
  246.   lineTooLong              * = 120;
  247.   fileNotObject            * = 121;
  248.   invalidResidentLibrary   * = 122;
  249.   noDefaultDir             * = 201;
  250.   objectInUse              * = 202;
  251.   objectExists             * = 203;
  252.   dirNotFound              * = 204;
  253.   objectNotFound           * = 205;
  254.   badStreamName            * = 206;
  255.   objectTooLarge           * = 207;
  256.   actionNotKnown           * = 209;
  257.   invalidComponentName     * = 210;
  258.   invalidLock              * = 211;
  259.   objectWrongType          * = 212;
  260.   diskNotValidated         * = 213;
  261.   diskWriteProtected       * = 214;
  262.   renameAcrossDevices      * = 215;
  263.   directoryNotEmpty        * = 216;
  264.   tooManyLevels            * = 217;
  265.   deviceNotMounted         * = 218;
  266.   seekError                * = 219;
  267.   commentTooBig            * = 220;
  268.   diskFull                 * = 221;
  269.   deleteProtected          * = 222;
  270.   writeProtected           * = 223;
  271.   readProtected            * = 224;
  272.   notADosDisk              * = 225;
  273.   noDisk                   * = 226;
  274.   noMoreEntries            * = 232;
  275. (* added for 1.4 *)
  276.   isSoftLink               * = 233;
  277.   objectLinked             * = 234;
  278.   badHunk                  * = 235;
  279.   notImplemented           * = 236;
  280.   recordNotLocked          * = 240;
  281.   lockCollision            * = 241;
  282.   lockTimeout              * = 242;
  283.   unlockError              * = 243;
  284.  
  285. (* error codes 303-305 are defined in dosasl.h *)
  286.  
  287. (* These are the return codes used by convention by AmigaDOS commands *)
  288. (* See FAILAT and IF for relvance to EXECUTE files                    *)
  289.   ok                         * = 0;  (* No problems, success *)
  290.   warn                       * = 5;  (* A warning only *)
  291.   error                      * = 10;  (* Something wrong *)
  292.   fail                       * = 20;  (* Complete or severe failure*)
  293.  
  294. (* Bit numbers that signal you that a user has issued a break *)
  295.   ctrlC  * = 12;
  296.   ctrlD  * = 13;
  297.   ctrlE  * = 14;
  298.   ctrlF  * = 15;
  299.  
  300. (* Values returned by SameLock() *)
  301.   different         * = -1;
  302.   same              * = 0;
  303.   sameVolume        * = 1;       (* locks are on same volume *)
  304.   sameHandler       * = sameVolume;
  305. (* sameHandler was a misleading name, def kept for src compatibility *)
  306.  
  307. (* types for ChangeMode() *)
  308.   changeLock    * = 0;
  309.   changeFH      * = 1;
  310.  
  311. (* Values for MakeLink() *)
  312.   hard      * = 0;
  313.   soft      * = 1;       (* softlinks are not fully supported yet *)
  314.  
  315. (* values returned by ReadItem *)
  316.   equal     * = -2;              (* "=" Symbol *)
  317.   itemError * = -1;              (* error *)
  318.   nothing   * = 0;               (* *N, ;, endstreamch *)
  319.   unQuoted  * = 1;               (* unquoted item *)
  320.   quoted    * = 2;               (* quoted item *)
  321.  
  322. (* types for AllocDosObject/FreeDosObject *)
  323.   fileHandle         * = 0;       (* few people should use this *)
  324.   exAllControl       * = 1;       (* Must be used to allocate this! *)
  325.   fib                * = 2;       (* useful *)
  326.   stdPkt             * = 3;       (* for doing packet-level I/O *)
  327.   cli                * = 4;       (* for shell-writers, etc *)
  328.   rdArgs             * = 5;       (* for ReadArgs if you pass it in *)
  329.  
  330. (*
  331. **      $VER: datetime.h 36.7 (12.7.90)
  332. **
  333. **      Date and time header for AmigaDOS
  334. *)
  335.  
  336. (*
  337.  *      Data structures and equates used by the V1.4 DOS functions
  338.  * StrtoDate() and DatetoStr()
  339.  *)
  340.  
  341. CONST
  342.  
  343. (* You need this much room for each of the DateTime strings: *)
  344.   lenDatString  * = 16;
  345.  
  346. TYPE
  347.   DatString * = ARRAY lenDatString OF CHAR;
  348.   DatStringPtr * = POINTER TO DatString;
  349.  
  350. (* --------- String/Date structures etc *)
  351.   DateTime* = RECORD (DateBase)
  352.     stamp *  : Date;          (* DOS Date *)
  353.     format * : SHORTINT;      (* controls appearance of datStrDate *)
  354.     flags  * : s.SET8;        (* see BITDEF's below *)
  355.     strDay * : DatStringPtr;  (* day of the week string *)
  356.     strDate* : DatStringPtr;  (* date string *)
  357.     strTime* : DatStringPtr;  (* time string *)
  358.   END; (* DateTime *)
  359.  
  360. CONST
  361.  
  362. (*      flags for datFlags *)
  363.  
  364.   subst      * = 0;               (* substitute Today, Tomorrow, etc. *)
  365.   future     * = 1;               (* day of the week is in future *)
  366.  
  367. (*
  368.  *      date format values
  369.  *)
  370.  
  371.   formatDos     * = 0;               (* dd-mmm-yy *)
  372.   formatInt     * = 1;               (* yy-mm-dd  *)
  373.   formatUSA     * = 2;               (* mm-dd-yy  *)
  374.   formatCDN     * = 3;               (* dd-mm-yy  *)
  375.   formatMax     * = formatCDN;
  376.  
  377. (*
  378. **      $VER: dosasl.h 36.16 (2.5.91)
  379. **
  380. **      Pattern-matching structure definitions
  381. *)
  382.  
  383. (***********************************************************************
  384. ************************ PATTERN MATCHING ******************************
  385. ************************************************************************
  386.  
  387. * structure expected by MatchFirst, MatchNext.
  388. * Allocate this structure and initialize it as follows:
  389. *
  390. * Set apBreakBits to the signal bits (CDEF) that you want to take a
  391. * break on, or NULL, if you don't want to convenience the user.
  392. *
  393. * If you want to have the FULL PATH NAME of the files you found,
  394. * allocate a buffer at the END of this structure, and put the size of
  395. * it into apStrlen.  If you don't want the full path name, make sure
  396. * you set apStrlen to zero.  In this case, the name of the file, and stats
  397. * are available in the apInfo, as per usual.
  398. *
  399. * Then call MatchFirst() and then afterwards, MatchNext() with this structure.
  400. * You should check the return value each time (see below) and take the
  401. * appropriate action, ultimately calling MatchEnd() when there are
  402. * no more files and you are done.  You can tell when you are done by
  403. * checking for the normal AmigaDOS return code errornomoreENTRIES.
  404. *
  405. *)
  406.  
  407. TYPE
  408.  
  409.   AnchorPath* = RECORD
  410.     base      * : AChainPtr;   (* pointer to first anchor *)
  411.     last      * : AChainPtr;   (* pointer to last anchor *)
  412.     breakBits * : s.SET32;     (* Bits we want to break on *)
  413.     foundBreak* : s.SET32;     (* Bits we broke on. Also returns errorBREAK *)
  414.     flags     * : s.SET8;      (* New use for extra word. *)
  415.     reserved  * : e.BYTE;
  416.     strlen    * : INTEGER;     (* This is what apLength used to be *)
  417.     info      * : FileInfoBlock;
  418.     buf       * : e.STRING;    (* Buffer for path name, allocated by user *)
  419.   END; (* AnchorPath *)
  420.  
  421.  
  422. CONST
  423.  
  424.   doWild     * = 0;       (* User option ALL *)
  425.   itsWild    * = 1;       (* Set by MatchFirst, used by MatchNext  *)
  426.                           (* Application can test apItsWild,  too  *)
  427.                           (* (means that there's a wildcard        *)
  428.                           (* in the pattern after calling          *)
  429.                           (* MatchFirst).                          *)
  430.   doDir      * = 2;       (* Bit is SET if a DIR node should be *)
  431.                           (* entered. Application can RESET this *)
  432.                           (* bit after MatchFirst/MatchNext to AVOID *)
  433.                           (* entering a dir. *)
  434.   didDir     * = 3;       (* Bit is SET for an "expired" dir node. *)
  435.   noMemErr   * = 4;       (* Set on memory error *)
  436.   doDot      * = 5;       (* If set, allow conversion of '.' to *)
  437.                           (* CurrentDir *)
  438.   dirChanged * = 6;       (* apcurrent->anLock changed *)
  439.                           (* since last MatchNext call *)
  440.   followHLinks* = 7;      (* follow hardlinks on DODIR - defaults   *)
  441.                           (* to not following hardlinks on a DODIR. *)
  442.  
  443. TYPE
  444.  
  445.   AChain* = RECORD
  446.     child  * : AChainPtr;
  447.     parent * : AChainPtr;
  448.     lock   * : FileLockPtr;
  449.     info   * : FileInfoBlock;
  450.     flags  * : s.SET8;
  451.     string * : e.STRING;
  452.   END; (* AChain *)
  453.  
  454. CONST
  455.  
  456.   patternBit * = 0;
  457.   examinedBit* = 1;
  458.   completed  * = 2;
  459.   allBit     * = 3;
  460.   single     * = 4;
  461.  
  462. (*
  463.  * Constants used by wildcard routines, these are the pre-parsed tokens
  464.  * referred to by pattern match.  It is not necessary for you to do
  465.  * anything about these, MatchFirst() MatchNext() handle all these for you.
  466.  *)
  467.  
  468.   pAny          * = 80H;    (* Token for '*' or '#?  *)
  469.   pSingle       * = 81H;    (* Token for '?' *)
  470.   pOrStart      * = 82H;    (* Token for '(' *)
  471.   pOrNext       * = 83H;    (* Token for '|' *)
  472.   pOeEnd        * = 84H;    (* Token for ')' *)
  473.   pNot          * = 85H;    (* Token for '~' *)
  474.   pNotEnd       * = 86H;    (* Token for *)
  475.   pNotClass     * = 87H;    (* Token for '^' *)
  476.   pClass        * = 88H;    (* Token for '[]' *)
  477.   pRepBeg       * = 89H;    (* Token for '[' *)
  478.   pRepEnd       * = 8AH;    (* Token for ']' *)
  479.   pStop         * = 8BH;    (* token to force end of evaluation *)
  480.  
  481. (* Values for anStatus, NOTE: These are the actual bit numbers *)
  482.  
  483.   complexBit    * = 1;       (* Parsing complex pattern *)
  484.   examineBit    * = 2;       (* Searching directory *)
  485.  
  486. (*
  487.  * Returns from MatchFirst(), MatchNext()
  488.  * You can also get dos error returns, such as errornomoreENTRIES,
  489.  * these are in the dos.h file.
  490.  *)
  491.  
  492.   bufferOverflow  * = 303;     (* User or internal buffer overflow *)
  493.   break           * = 304;     (* A break character was received *)
  494.   notExecutable   * = 305;     (* A file has E bit cleared *)
  495.  
  496.  
  497. (*
  498. **      $VER: doshunks.h 36.9 (2.6.92)
  499. **
  500. **      Hunk definitions for object and load modules.
  501. *)
  502.  
  503. CONST
  504.  
  505. (* hunk types *)
  506.   hunkUnit      * = 999;
  507.   hunkName      * = 1000;
  508.   hunkCode      * = 1001;
  509.   hunkData      * = 1002;
  510.   hunkBSS       * = 1003;
  511.   hunkReloc32   * = 1004;
  512.   hunkAbsReloc32 * = hunkReloc32;
  513.   hunkReloc16   * = 1005;
  514.   hunkRelReloc16 * = hunkReloc16;
  515.   hunkReloc8    * = 1006;
  516.   hunkRelReloc8 * = hunkReloc8;
  517.   hunkExt       * = 1007;
  518.   hunkSymbol    * = 1008;
  519.   hunkDebug     * = 1009;
  520.   hunkEnd       * = 1010;
  521.   hunkHeader    * = 1011;
  522.  
  523.   hunkOverlay   * = 1013;
  524.   hunkBreak     * = 1014;
  525.  
  526.   hunkDRel32    * = 1015;
  527.   hunkDRel16    * = 1016;
  528.   hunkDRel8     * = 1017;
  529.  
  530.   hunkLib       * = 1018;
  531.   hunkIndex     * = 1019;
  532.  
  533. (*
  534.  * Nkte: V37 LoadSeg uses 1015 (hunkDRel32) by mistake.  This will continue
  535.  * to be supported in future versions, since hunkDRel32 is illegal in load files
  536.  * anyways.  Future versions will support both 1015 and 1020, though anything
  537.  * that should be usable under V37 should use 1015.
  538.  *)
  539.   hunkReloc32Short * = 1020;
  540.  
  541. (* see ext_xxx below.  New for V39 (note that LoadSeg only handles relReloc32).*)
  542.   hunkRelReloc32 * = 1021;
  543.   hunkAbsReloc16 * = 1022;
  544.  
  545. (*
  546.  * Any hunks that have the hunkAdvisory bit set will be ignored if they
  547.  * aren't understood.  When ignored, they're treated like hunkDebug hunks.
  548.  * NOTE: this handling of hunkAdvisory started as of V39 dos.library!  If
  549.  * lading such executables is attempted under <V39 dos, it will fail with a
  550.  * bad hunk type.
  551.  *)
  552.   hunkAdvisory * = 29;
  553.   hunkChip * = 30;
  554.   hunkFast * = 31;
  555.  
  556.  
  557. (* hunkext sub-types *)
  558.   extSymb       * = 0;       (* symbol table *)
  559.   extDef        * = 1;       (* relocatable definition *)
  560.   extAbs        * = 2;       (* Absolute definition *)
  561.   extRes        * = 3;       (* no longer supported *)
  562.   extRef32      * = 129;     (* 32 bit reference to symbol *)
  563.   extAbsRef32   * = extRef32;
  564.   extCommon     * = 130;     (* 32 bit reference to COMMON block *)
  565.   extAbsCommon  * = extCommon;
  566.   extRef16      * = 131;     (* 16 bit reference to symbol *)
  567.   extRelRef16   * = extRef16;
  568.   extRef8       * = 132;     (*  8 bit reference to symbol *)
  569.   extRelRef8    * = extRef8;
  570.   extDExt32     * = 133;     (* 32 bit data releative reference *)
  571.   extDExt16     * = 134;     (* 16 bit data releative reference *)
  572.   extDExt8      * = 135;     (*  8 bit data releative reference *)
  573.  
  574. (* These are to support some of the '020 and up modes that are rarely used *)
  575.   extRelRef32   * = 136;     (* 32 bit PC-relative reference to symbol *)
  576.   extRelCommon  * = 137;     (* 32 bit PC-relative reference to COMMON block *)
  577.  
  578. (* for completeness... All 680x0's support this *)
  579.   extAbsRef16   * = 138;     (* 16 bit absolute reference to symbol *)
  580.  
  581. (* this only exists on '020's and above, in the (d8,An,Xn) address mode *)
  582.   extAbsRef8    * = 139;     (* 8 bit absolute reference to symbol *)
  583.  
  584.  
  585. (*
  586. **      $VER: filehandler.h 36.6 (9.8.92)
  587. **
  588. **      device and file handler specific code for AmigaDOS
  589. *)
  590.  
  591. TYPE
  592.  
  593. (* The disk "environment" is a longword array that describes the
  594.  * disk geometry.  It is variable sized, with the length at the beginning.
  595.  * Here are the constants for a standard geometry.
  596.  *)
  597.  
  598.   DosEnvec* = RECORD
  599.     tableSize     * : e.ULONG; (* Size of Environment vector *)
  600.     sizeBlock     * : e.ULONG; (* in longwords: standard value is 128 *)
  601.     secOrg        * : e.ULONG; (* not used; must be 0 *)
  602.     surfaces      * : e.ULONG; (* # of heads (surfaces). drive specific *)
  603.     sectorPerBlock* : e.ULONG; (* not used; must be 1 *)
  604.     blocksPerTrack* : e.ULONG; (* blocks per track. drive specific *)
  605.     reserved      * : e.ULONG; (* DOS reserved blocks at start of partition. *)
  606.     preAlloc      * : e.ULONG; (* DOS reserved blocks at end of partition *)
  607.     interleave    * : e.ULONG; (* usually 0 *)
  608.     lowCyl        * : e.ULONG; (* starting cylinder. typically 0 *)
  609.     highCyl       * : e.ULONG; (* max cylinder. drive specific *)
  610.     numBuffers    * : e.ULONG; (* Initial # DOS of buffers.  *)
  611.     bufMemType    * : e.ULONG; (* type of mem to allocate for buffers *)
  612.     maxTransfer   * : e.ULONG; (* Max number of bytes to transfer at a time *)
  613.     mask          * : s.SET32; (* Address Mask to block out certain memory *)
  614.     bootPri       * : LONGINT; (* Boot priority for autoboot *)
  615.     dosType       * : e.ULONG; (* ASCII (HEX) string showing filesystem type;
  616.                                 * 444F5300H is old filesystem,
  617.                                 * 444F5301H is fast file system *)
  618.     baud          * : e.ULONG; (* Baud rate for serial handler *)
  619.     control       * : e.ULONG; (* Control word for handler/filesystem *)
  620.     bootBlocks    * : e.ULONG; (* Number of blocks containing boot code *)
  621.  
  622.   END; (* DosEnvec *)
  623.  
  624. CONST
  625.  
  626. (* these are the offsets into the array *)
  627. (* deTableSize is set to the number of longwords in the table minus 1 *)
  628.  
  629.   tableSize   * = 0;       (* minimum value is 11 (includes NumBuffers) *)
  630.   sizeBlock   * = 1;       (* in longwords: standard value is 128 *)
  631.   secOrg      * = 2;       (* not used; must be 0 *)
  632.   numHeads    * = 3;       (* # of heads (surfaces). drive specific *)
  633.   secsPerBlk  * = 4;       (* not used; must be 1 *)
  634.   blksPerTrack* = 5;       (* blocks per track. drive specific *)
  635.   reservedBlks* = 6;       (* unavailable blocks at start.  usually 2 *)
  636.   prefac      * = 7;       (* not used; must be 0 *)
  637.   interleave  * = 8;       (* usually 0 *)
  638.   lowCyl      * = 9;       (* starting cylinder. typically 0 *)
  639.   upperCyl    * = 10;      (* max cylinder.  drive specific *)
  640.   numBuffers  * = 11;      (* starting # of buffers.  typically 5 *)
  641.   memBufType  * = 12;      (* type of mem to allocate for buffers. *)
  642.   bufMemType  * = 12;      (* same as above, better name
  643.                             * 1 is public, 3 is chip, 5 is fast *)
  644.   maxTransfer * = 13;      (* Max number bytes to transfer at a time *)
  645.   mask        * = 14;      (* Address Mask to block out certain memory *)
  646.   bootPri     * = 15;      (* Boot priority for autoboot *)
  647.   dosType     * = 16;      (* ASCII (HEX) string showing filesystem type;
  648.                             * 444F5300H is old filesystem,
  649.                             * 444F5301H is fast file system *)
  650.   baud        * = 17;      (* Baud rate for serial handler *)
  651.   control     * = 18;      (* Control word for handler/filesystem *)
  652.   bootBlocks  * = 19;      (* Number of blocks containing boot code *)
  653.  
  654. TYPE
  655.  
  656. (* The file system startup message is linked into a device node's startup
  657. ** field.  It contains a pointer to the above environment, plus the
  658. ** information needed to do an exec OpenDevice().
  659. *)
  660.   FileSysStartupMsg* = RECORD
  661.     unit   * : e.ULONG;     (* exec unit number for this device *)
  662.     device * : BSTR;        (* null terminated bstring to the device name *)
  663.     environ* : DosEnvecPtr; (* ptr to environment table (see above) *)
  664.     flags  * : s.SET32;     (* flags for OpenDevice() *)
  665.   END; (* FileSysStartupMsg *)
  666.  
  667.  
  668. (* The include file "libraries/dosextens.h" has a DeviceList structure.
  669.  * The "device list" can have one of three different things linked onto
  670.  * it.  Dosextens defines the structure for a volume.  dltDirectory
  671.  * is for an assigned directory.  The following structure is for
  672.  * a dos "device" (dltDevice).
  673. *)
  674.  
  675.   DeviceNode* = RECORD
  676.     next     * : DeviceNodePtr; (* singly linked list *)
  677.     type     * : e.ULONG;       (* always 0 for dos "devices" *)
  678.     task     * : ProcessId;     (* standard dos "task" field.  If this is
  679.                                  * null when the node is accesses, a task
  680.                                  * will be started up *)
  681.     lock     * : FileLockPtr;   (* not used for devices -- leave null *)
  682.     handler  * : BSTR;          (* filename to loadseg (if seglist is null) *)
  683.     stackSize* : e.ULONG;       (* stacksize to use when starting task *)
  684.     priority * : LONGINT;       (* task priority when starting task *)
  685.     startup  * : FileSysStartupMsgPtr; (* startup msg: FileSysStartupMsg for disks *)
  686.     segList  * : e.BPTR;        (* code to run to start new task (if necessary).
  687.                                  * if null then dnHandler will be loaded. *)
  688.     globalVec* : e.BPTR;        (* BCPL global vector to use when starting
  689.                                  * a task.  -1 means that dnSegList is not
  690.                                  * for a bcpl program, so the dos won't
  691.                                  * try and construct one.  0 tell the
  692.                                  * dos that you obey BCPL linkage rules,
  693.                                  * and that it should construct a global
  694.                                  * vector for you.
  695.                                  *)
  696.     name     * : BSTR;          (* the node name, e.g. '\3','D','F','3' *)
  697.   END; (* DeviceNode *)
  698.  
  699.  
  700. (*
  701. **      $VER: notify.h 36.8 (29.8.90)
  702. **
  703. **      dos notification definitions
  704. *)
  705.  
  706. CONST
  707.  
  708. (* use of Class and code is discouraged for the time being - we might want
  709.    to change things *)
  710. (* --- NotifyMessage Class ---------------------------------------------- *)
  711.   class   * = 40000000H;
  712.  
  713. (* --- NotifyMessage Codes ---------------------------------------------- *)
  714.   code    * = 1234H;
  715.  
  716. TYPE
  717.  
  718. (* Sent to the application if sendMESSAGE is specified.                    *)
  719.  
  720.   NotifyMessage* = RECORD (e.MessageBase)
  721.     execMessage * : e.Message;
  722.     class       * : e.ULONG;
  723.     code        * : e.UWORD;
  724.     nReq        * : NotifyRequestPtr; (* don't modify the request! *)
  725.     doNotTouch    : e.ULONG;          (* like it says!  For use by handlers *)
  726.     doNotTouch2   : e.ULONG;          (* ditto *)
  727.   END; (* NotifyMessage *)
  728.  
  729. (* Do not modify or reuse the notifyrequest while active.                 *)
  730. (* note: the first LONG of nrData has the length transfered               *)
  731.  
  732.   NotifyRequest* = RECORD
  733.     name    *  : e.LSTRPTR;
  734.     fullName*  : e.LSTRPTR;             (* set by dos - don't touch *)
  735.     userData*  : e.ULONG;              (* for applications use *)
  736.     flags   *  : s.SET32;
  737.     task    *  : e.TaskPtr;            (* for sendSignal *)
  738.     (** port * : e.MsgPortPtr;         (* for sendMessage *)
  739.      *
  740.      * port occupies the same space as task (a C union). Access via:
  741.      * SYS.VAL (e.MsgPortPtr, NotifyRequest.task)
  742.      *)
  743.     signalNum* : e.UBYTE;              (* for sendSignal *)
  744.     pad        : ARRAY 3 OF e.UBYTE;
  745.     reserved*  : ARRAY 4 OF e.ULONG;   (* leave 0 for now *)
  746.  
  747.     (* internal use by handlers *)
  748.     msgCount*  : e.ULONG;              (* # of outstanding msgs *)
  749.     handler *  : e.MsgPortPtr;         (* handler sent to (for EndNotify) *)
  750.   END; (* NotifyRequest *)
  751.  
  752. CONST
  753.  
  754. (* --- NotifyRequest Flags ------------------------------------------------ *)
  755.  
  756. (* bit numbers *)
  757.   sendMessage       * = 0;
  758.   sendSignal        * = 1;
  759.   waitReply         * = 3;
  760.   notifyInitial     * = 4;
  761.  
  762. (* do NOT set or remove nrMagic!  Only for use by handlers! *)
  763.   magic              * = 31;
  764.  
  765. (* Flags reserved for private use by the handler: *)
  766.   handlerFlags       * = {16 .. 31};
  767.  
  768.  
  769. (*
  770. **      $VER: rdargs.h 36.6 (12.7.90)
  771. **
  772. **      ReadArgs() structure definitions
  773. *)
  774.  
  775. (**********************************************************************
  776.  *
  777.  * The CSource data structure defines the input source for "ReadItem()"
  778.  * as well as the ReadArgs call.  It is a publicly defined structure
  779.  * which may be used by applications which use code that follows the
  780.  * conventions defined for access.
  781.  *
  782.  * When passed to the dos.library functions, the value passed as
  783.  * struct *CSource is defined as follows:
  784.  *      if ( CSource == 0)      Use buffered IO "ReadChar()" as data source
  785.  *      else                    Use CSource for input character stream
  786.  *
  787.  * The following two pseudo-code routines define how the CSource structure
  788.  * is used:
  789.  *
  790.  * long csReadChar( CSource : CSourcePtr )
  791.  * {
  792.  *      if ( CSource == 0 )     return ReadChar();
  793.  *      if ( CSource->CurChr >= CSource->Length )       return ENDSTREAMCHAR;
  794.  *      return CSource->Buffer[ CSource->CurChr++ ];
  795.  * }
  796.  *
  797.  * BOOL csUnReadChar( CSource : CSourcePtr )
  798.  * {
  799.  *      if ( CSource == 0 )     return UnReadChar();
  800.  *      if ( CSource->CurChr <= 0 )     return FALSE;
  801.  *      CSource->CurChr--;
  802.  *      return TRUE;
  803.  * }
  804.  *
  805.  * To initialize a struct CSource, you set csource->csBuffer to
  806.  * a string which is used as the data source, and set csLength to
  807.  * the number of characters in the string.  Normally csCurChr should
  808.  * be initialized to ZERO, or left as it was from prior use as
  809.  * a CSource.
  810.  *
  811.  **********************************************************************)
  812.  
  813. TYPE
  814.  
  815.   CSource* = RECORD
  816.     buffer* : e.LSTRPTR;
  817.     length* : LONGINT;
  818.     curChr* : LONGINT;
  819.   END; (* CSource *)
  820.  
  821. (**********************************************************************
  822.  *
  823.  * The RDArgs data structure is the input parameter passed to the DOS
  824.  * ReadArgs() function call.
  825.  *
  826.  * The rdaSource structure is a CSource as defined above;
  827.  * if rdasource.csBuffer is non-null, rdaSource is used as the input
  828.  * character stream to parse, else the input comes from the buffered STDIN
  829.  * calls ReadChar/UnReadChar.
  830.  *
  831.  * rdaDAList is a private address which is used internally to track
  832.  * allocations which are freed by FreeArgs().  This MUST be initialized
  833.  * to NULL prior to the first call to ReadArgs().
  834.  *
  835.  * The rdaBuffer and rdaBufSiz fields allow the application to supply
  836.  * a fixed-size buffer in which to store the parsed data.  This allows
  837.  * the application to pre-allocate a buffer rather than requiring buffer
  838.  * space to be allocated.  If either rdaBuffer or rdaBufSiz is NULL,
  839.  * the application has not supplied a buffer.
  840.  *
  841.  * rdaExtHelp is a text string which will be displayed instead of the
  842.  * template string, if the user is prompted for input.
  843.  *
  844.  * rdaFlags bits control how ReadArgs() works.  The flag bits are
  845.  * defined below.  Defaults are initialized to ZERO.
  846.  *
  847.  **********************************************************************)
  848.  
  849. TYPE
  850.  
  851.   RDArgs* = RECORD
  852.     source * : CSource;     (* Select input source *)
  853.     daList * : LONGINT;     (* PRIVATE. *)
  854.     buffer * : e.LSTRPTR;   (* Optional string parsing space. *)
  855.     bufSiz * : LONGINT;     (* Size of rdaBuffer (0..n) *)
  856.     extHelp* : e.LSTRPTR;   (* Optional extended help *)
  857.     flags  * : s.SET32;     (* Flags for any required control *)
  858.   END; (* RDArgs *)
  859.  
  860. CONST
  861.  
  862.   stdIn     * = 0;       (* Use "STDIN" rather than "COMMAND LINE" *)
  863.   noAlloc   * = 1;       (* If set, do not allocate extra string space.*)
  864.   noPrompt  * = 2;       (* Disable reprompting for string input. *)
  865.  
  866. (**********************************************************************
  867.  * Maximum number of template keywords which can be in a template passed
  868.  * to ReadArgs(). IMPLEMENTOR NOTE - must be a multiple of 4.
  869.  **********************************************************************)
  870.   maxTemplateItems     * = 100;
  871.  
  872. (**********************************************************************
  873.  * Maximum number of MULTIARG items returned by ReadArgs(), before
  874.  * an errorLineTooLONG.  These two limitations are due to stack
  875.  * usage.  Applications should allow "a lot" of stack to use ReadArgs().
  876.  **********************************************************************)
  877.   maxMultiArgs          * = 128;
  878.  
  879.  
  880. (*
  881. **      $VER: record.h 36.5 (12.7.90)
  882. **
  883. **      include file for record locking
  884. *)
  885.  
  886. TYPE
  887. (*
  888.  * use an extension of this and pass it to ReadArgs()
  889.  * use one entry (see definitions below) for every template keyword
  890.  * according to it's type.
  891.  *)
  892.  
  893.   ArgsStruct * = RECORD END;
  894.  
  895.   ArgLong        * = POINTER TO ARRAY 1 OF LONGINT;   (* /N *)
  896.   ArgLongArray   * = POINTER TO ARRAY maxMultiArgs OF ArgLong;   (* /M/N*)
  897.   ArgBool        * = e.LONGBOOL;   (* /S, /T *)
  898.   ArgString      * = e.LSTRPTR;    (* /K, or nothing *)
  899.   ArgStringArray * = POINTER TO ARRAY maxMultiArgs OF ArgString; (* /K/M, /M *)
  900.  
  901.  
  902. CONST
  903.  
  904. (* Modes for LockRecord/LockRecords() *)
  905.   recExclusive         * = 0;
  906.   recExclusiveImmed    * = 1;
  907.   recShared            * = 2;
  908.   recSharedImmed       * = 3;
  909.  
  910. TYPE
  911.  
  912. (* struct to be passed to LockRecords()/UnLockRecords() *)
  913.  
  914.   RecordLock* = RECORD
  915.     fh    * : FileHandlePtr; (* filehandle *)
  916.     offset* : e.ULONG;       (* offset in file *)
  917.     length* : e.ULONG;       (* length of file to be locked *)
  918.     mode  * : e.ULONG;       (* Type of lock *)
  919.   END; (* RecordLock *)
  920.  
  921.  
  922. (*
  923. **      $VER: var.h 36.11 (2.6.92)
  924. **
  925. **      include file for dos local and environment variables
  926. *)
  927.  
  928. TYPE
  929.  
  930. (* the structure in the prLocalVars list *)
  931. (* Do NOT allocate yourself, use SetVar()!!! This structure may grow in *)
  932. (* future releases!  The list should be left in alphabetical order, and *)
  933. (* may have multiple entries with the same name but different types.    *)
  934.  
  935.   LocalVar* = RECORD (e.NodeBase)
  936.     node * : e.Node;
  937.     flags* : s.SET16;
  938.     value* : e.LSTRPTR;
  939.     len  * : e.ULONG;
  940.   END; (* LocalVar *)
  941.  
  942. CONST
  943.  
  944. (*
  945.  * The LocalVar.flags bits are available to the application.  The unused
  946.  * LocalVar.pri bits are reserved for system use.
  947.  *)
  948.  
  949. (* bit definitions for LocalVar.type: *)
  950.   var                 * = 0;       (* an variable *)
  951.   alias               * = 1;       (* an alias *)
  952. (* to be or'ed into LocalVar.type: *)
  953.   ignore              * = 7;       (* ignore this entry on GetVar, etc *)
  954.  
  955. (* definitions of flags passed to GetVar()/SetVar()/DeleteVar() *)
  956. (* bit defs to be OR'ed with the type: *)
  957. (* item will be treated as a single line of text unless binaryVAR is used *)
  958.   globalOnly        * = 8;
  959.   localOnly         * = 9;
  960.   binaryVar         * = 10;              (* treat variable as binary *)
  961.   dontNullTerm      * = 11;              (* only with gvBinaryVar *)
  962.  
  963. (* this is only supported in >= V39 dos.  V37 dos ignores this. *)
  964. (* this causes SetVar to affect ENVARC: as well as ENV:.        *)
  965.   saveVar           * = 12;              (* only with gvGlobalVar *)
  966.  
  967.  
  968. (*
  969. **      $VER: dostags.h 36.11 (29.4.91)
  970. **
  971. **      Tag definitions for all Dos routines using tags
  972. *)
  973.  
  974. CONST
  975.  
  976. (*****************************************************************************)
  977. (* definitions for the System() call *)
  978.  
  979.   sysDummy      * = u.user + 32;
  980.   sysInput      * = sysDummy + 1; (* specifies the input filehandle  *)
  981.   sysOutput     * = sysDummy + 2; (* specifies the output filehandle *)
  982.   sysAsynch     * = sysDummy + 3; (* run asynch, close input/output on exit(!) *)
  983.   sysUserShell  * = sysDummy + 4; (* send to user shell instead of boot shell *)
  984.   sysCustomShell* = sysDummy + 5; (* send to a specific shell (data is name) *)
  985.  
  986. (*****************************************************************************)
  987. (* definitions for the CreateNewProc() call *)
  988. (* you MUST specify one of npSeglist or npEntry.  All else is optional. *)
  989.  
  990.   npDummy       * = u.user + 1000;
  991.   npSeglist     * = npDummy + 1; (* seglist of code to run for the process  *)
  992.   npFreeSeglist * = npDummy + 2; (* free seglist on exit - only valid for   *)
  993.                                  (* for npSeglist.  Default is TRUe.       *)
  994.   npEntry       * = npDummy + 3; (* entry point to run - mutually exclusive *)
  995.                                  (* with npSeglist! *)
  996.   npInput       * = npDummy + 4; (* filehandle - default is Open("NIL:"...) *)
  997.   npOutput      * = npDummy + 5; (* filehandle - default is Open("NIL:"...) *)
  998.   npCloseInput  * = npDummy + 6; (* close input filehandle on exit          *)
  999.                                  (* default TRUE                            *)
  1000.   npCloseOutput * = npDummy + 7; (* close output filehandle on exit         *)
  1001.                                  (* default TRUE                            *)
  1002.   npError       * = npDummy + 8; (* filehandle - default is Open("NIL:"...) *)
  1003.   npCloseError  * = npDummy + 9; (* close error filehandle on exit          *)
  1004.                                  (* default TRUE                            *)
  1005.   npCurrentDir  * = npDummy + 10; (* lock - default is parent's current dir  *)
  1006.   npStackSize   * = npDummy + 11; (* stacksize for process - default 4000    *)
  1007.   npName        * = npDummy + 12; (* name for process - default "New Process"*)
  1008.   npPriority    * = npDummy + 13; (* priority - default same as parent       *)
  1009.   npConsoleTask * = npDummy + 14; (* consoletask - default same as parent    *)
  1010.   npWindowPtr   * = npDummy + 15; (* window ptr - default is same as parent  *)
  1011.   npHomeDir     * = npDummy + 16; (* home directory - default curr home dir  *)
  1012.   npCopyVars    * = npDummy + 17; (* boolean to copy local vars-default TRUE *)
  1013.   npCli         * = npDummy + 18; (* create cli structure - default FALSE    *)
  1014.   npPath        * = npDummy + 19; (* path - default is copy of parents path  *)
  1015.                                   (* only valid if a cli process!    *)
  1016.   npCommandName * = npDummy + 20; (* commandname - valid only for CLI        *)
  1017.   npArguments   * = npDummy + 21; (* cstring of arguments - passed with str in a0, length in d0.  *)
  1018.                                   (* (copied and freed on exit.)  Default is 0-length NULL ptr.   *)
  1019.                                   (* NOTE: not operational until V37 - see BIX/TechNotes for      *)
  1020.                                   (* more info/workaround.  In V36, the registers were random.    *)
  1021.                                   (* You must NEVER use npArguments with a npInput of NULL.       *)
  1022. (* FIX! should this be only for cli's? *)
  1023.   npNotifyOnDeath* = npDummy + 22; (* notify parent on death - default FALSE  *)
  1024.                                    (* Not functional yet. *)
  1025.   npSynchronous * = npDummy + 23; (* don't return until process finishes -   *)
  1026.                                   (* default FALSe.                          *)
  1027.                                   (* Not functional yet. *)
  1028.   npExitCode    * = npDummy + 24; (* code to be called on process exit       *)
  1029.   npExitData    * = npDummy + 25; (* optional argument for npEndCode rtn -  *)
  1030.                                   (* default NULL                           *)
  1031.  
  1032.  
  1033. (*****************************************************************************)
  1034. (* tags for AllocDosObject *)
  1035.  
  1036.   adoDummy     * = u.user + 2000;
  1037.   adoFHMode    * = adoDummy + 1;
  1038.                               (* for type dosFILEHANDLE only            *)
  1039.                               (* sets up FH for mode specified.
  1040.                                  This can make a big difference for buffered
  1041.                                  files.                                  *)
  1042.        (* The following are for dosCLI *)
  1043.        (* If you do not specify these, dos will use it's preferred values *)
  1044.        (* which may change from release to release.  The BPTRs to these   *)
  1045.        (* will be set up correctly for you.  Everything will be zero,     *)
  1046.        (* except cliFailLevel (10) and cliBackground (DOSTRUE).           *)
  1047.        (* NOTE: you may also use these 4 tags with CreateNewProc.         *)
  1048.  
  1049.   adoDirLen     * = adoDummy + 2; (* size in bytes for current dir buffer    *)
  1050.   adoCommNameLen* = adoDummy + 3; (* size in bytes for command name buffer   *)
  1051.   adoCommFileLen* = adoDummy + 4; (* size in bytes for command file buffer   *)
  1052.   adoPromptLen  * = adoDummy + 5; (* size in bytes for the prompt buffer     *)
  1053.  
  1054. (*****************************************************************************)
  1055. (* tags for NewLoadSeg *)
  1056. (* no tags are defined yet for NewLoadSeg *)
  1057.  
  1058.  
  1059. (*
  1060. **      $VER: exall.h 36.6 (5.4.92)
  1061. **
  1062. **      include file for ExAll() data structures
  1063. *)
  1064.  
  1065. (* NOTE: V37 dos.library, when doing ExAll() emulation, and V37 filesystems  *)
  1066. (* will return an error if passed edOwner.  If you get errorBadNumber,    *)
  1067. (* retry with edComment to get everything but owner info.  All filesystems  *)
  1068. (* supporting ExAll() must support through edComment, and must check Type   *)
  1069. (* and return errorBadNumber if they don't support the type.               *)
  1070.  
  1071. CONST
  1072.  
  1073. (* values that can be passed for what data you want from ExAll() *)
  1074. (* each higher value includes those below it (numerically)       *)
  1075. (* you MUST chose one of these values *)
  1076.   name        * = 1;
  1077.   type        * = 2;
  1078.   size        * = 3;
  1079.   protection  * = 4;
  1080.   date        * = 5;
  1081.   comment     * = 6;
  1082.   owner       * = 7;
  1083.  
  1084. TYPE
  1085.  
  1086. (*
  1087.  *   Structure in which exall results are returned in.  Note that only the
  1088.  *   fields asked for will exist!
  1089.  *)
  1090.  
  1091.   ExAllData* = RECORD
  1092.     next     * : ExAllDataPtr;
  1093.     name     * : e.LSTRPTR;
  1094.     type     * : LONGINT;
  1095.     size     * : e.ULONG;
  1096.     prot     * : s.SET32;
  1097.     days     * : e.ULONG;
  1098.     mins     * : e.ULONG;
  1099.     ticks    * : e.ULONG;
  1100.     comment  * : e.LSTRPTR;     (* strings will be after last used field *)
  1101.     ownerUID * : e.UWORD;      (* new for V39 *)
  1102.     ownerGID * : e.UWORD;
  1103.   END; (* ExAllData *)
  1104.  
  1105. (*
  1106.  *   Control structure passed to ExAll.  Unused fields MUST be initialized to
  1107.  *   0, expecially eacLastKey.
  1108.  *
  1109.  *   eacMatchFunc is a hook (see utility.library documentation for usage)
  1110.  *   It should return true if the entry is to returned, false if it is to be
  1111.  *   ignored.
  1112.  *
  1113.  *   This structure MUST be allocated by AllocDosObject()!
  1114.  *)
  1115.  
  1116.   ExAllControl* = RECORD
  1117.     entries    * : e.ULONG;   (* number of entries returned in buffer      *)
  1118.     lastKey    * : e.ULONG;   (* Don't touch inbetween linked ExAll calls! *)
  1119.     matchString* : e.LSTRPTR; (* wildcard string for pattern match or NULL *)
  1120.     matchFunc  * : u.HookPtr; (* optional private wildcard function     *)
  1121.   END; (* ExAllControl *)
  1122.  
  1123. (*
  1124. **      $VER: dosextens.h 36.41 (14.5.92)
  1125. **
  1126. **      DOS structures not needed for the casual AmigaDOS user
  1127. *)
  1128.  
  1129. TYPE
  1130.  
  1131. (* All DOS processes have this structure *)
  1132. (* Create and Device Proc returns pointer to the MsgPort in this structure *)
  1133. (* devproc* = (DeviceProc(..) - SIZE (Task)); *)
  1134.  
  1135.   Process* = RECORD (e.TaskBase)
  1136.     task          * : e.Task;
  1137.     msgPort       * : e.MsgPort;     (* This is BPTR address from DOS functions  *)
  1138.     pad           * : INTEGER;       (* Remaining variables on 4 byte boundaries *)
  1139.     segList       * : e.BPTR;          (* Array of seg lists used by this process  *)
  1140.     stackSize     * : LONGINT;       (* Size of process stack in bytes           *)
  1141.     globVec       * : e.APTR;        (* Global vector for this process (BCPL)    *)
  1142.     taskNum       * : LONGINT;       (* CLI task number of zero if not a CLI     *)
  1143.     stackBase     * : e.BPTR;          (* Ptr to high memory end of process stack  *)
  1144.     result2       * : LONGINT;       (* Value of secondary result from last call *)
  1145.     currentDir    * : FileLockPtr;   (* Lock associated with current directory   *)
  1146.     cis           * : FileHandlePtr; (* Current CLI Input Stream                 *)
  1147.     cos           * : FileHandlePtr; (* Current CLI Output Stream                *)
  1148.     consoleTask   * : ProcessId;     (* Console handler process for current window*)
  1149.     fileSystemTask* : ProcessId;     (* File handler process for current drive   *)
  1150.     cli           * : CommandLineInterfacePtr;
  1151.                                      (* pointer to CommandLineInterface          *)
  1152.     returnAddr    * : e.APTR;        (* pointer to previous stack frame          *)
  1153.     pktWait       * : e.APTR;        (* Function to be called when awaiting msg  *)
  1154.     windowPtr     * : e.APTR;        (* Window for error printing                *)
  1155.  
  1156.     (* following definitions are new with 2.0 *)
  1157.     homeDir       * : FileLockPtr;   (* Home directory of executing program      *)
  1158.     flags         * : s.SET32;       (* flags telling dos about process          *)
  1159.     exitCode      * : e.PROC;        (* code to call on exit of program or NULL  *)
  1160.     exitData      * : LONGINT;       (* Passed as an argument to prExitCode.     *)
  1161.     arguments     * : e.LSTRPTR;     (* Arguments passed to the process at start *)
  1162.     localVars     * : e.MinList;     (* Local environment variables              *)
  1163.     shellPrivate  * : e.ULONG;       (* for the use of the current shell         *)
  1164.     ces           * : FileHandlePtr; (* Error stream - if NULL, use prCOS        *)
  1165.   END; (* Process *)
  1166.  
  1167. CONST
  1168.  
  1169. (*
  1170.  * Flags for Process.prFlags
  1171.  *)
  1172.   freeSegList        * = 0;
  1173.   freeCurrDir        * = 1;
  1174.   freeCli            * = 2;
  1175.   closeInput         * = 3;
  1176.   closeOutput        * = 4;
  1177.   freeArgs           * = 5;
  1178.  
  1179. TYPE
  1180.  
  1181. (* The long word address (BPTR) of this structure is returned by
  1182.  * Open() and other routines that return a file.  You need only worry
  1183.  * about this struct to do async io's via PutMsg() instead of
  1184.  * standard file system calls *)
  1185.  
  1186.   FileHandle* = RECORD
  1187.     link  * : e.MessagePtr; (* EXEC message              *)
  1188.     port  * : e.MsgPortPtr; (* Reply port for the packet *)
  1189.     type  * : ProcessId;    (* Port to do PutMsg() to
  1190.                              * Address is negative if a plain file *)
  1191.     buf   * : LONGINT;
  1192.     pos   * : LONGINT;
  1193.     end   * : LONGINT;
  1194.     func1 * : LONGINT;
  1195.     func2 * : LONGINT;
  1196.     func3 * : LONGINT;
  1197.     arg1  * : LONGINT;
  1198.     arg2  * : LONGINT;
  1199.   END; (* FileHandle *)
  1200.  
  1201. (* This is the extension to EXEC Messages used by DOS *)
  1202.  
  1203.   DosPacket* = RECORD
  1204.     link* : e.MessagePtr;     (* EXEC message              *)
  1205.     port* : e.MsgPortPtr;     (* Reply port for the packet *)
  1206.                               (* Must be filled in each send. *)
  1207.     type* : LONGINT;          (* See action... below and
  1208.                                * 'R' means Read, 'W' means Write to the
  1209.                                * file system *)
  1210.     res1* : LONGINT;          (* For file system calls this is the result
  1211.                                * that would have been returned by the
  1212.                                * function, e.g. Write ('W') returns actual
  1213.                                * length written *)
  1214.     res2* : LONGINT;          (* For file system calls this is what would
  1215.                                * have been returned by IoErr() *)
  1216.     arg1* : LONGINT;
  1217.     arg2* : LONGINT;
  1218.     arg3* : LONGINT;
  1219.     arg4* : LONGINT;
  1220.     arg5* : LONGINT;
  1221.     arg6* : LONGINT;
  1222.     arg7* : LONGINT;
  1223.   END; (* DosPacket *)
  1224.  
  1225. (* A Packet does not require the Message to be before it in memory, but
  1226.  * for convenience it is useful to associate the two.
  1227.  * Also see the function initstdpkt for initializing this structure *)
  1228.  
  1229.   StandardPacket* = RECORD (e.MessageBase)
  1230.     msg * : e.Message;
  1231.     pkt * : DosPacket;
  1232.   END; (* StandardPacket *)
  1233.  
  1234. CONST
  1235.  
  1236. (* DosPacket types *)
  1237.   nil             * = 0;
  1238.   startup         * = 0;
  1239.   getBlock        * = 2;       (* OBSOLETE *)
  1240.   setMap          * = 4;
  1241.   die             * = 5;
  1242.   event           * = 6;
  1243.   currentVolume   * = 7;
  1244.   locateObject    * = 8;
  1245.   renameDisk      * = 9;
  1246.   write           * = ORD ("W");
  1247.   read            * = ORD ("R");
  1248.   freeLock        * = 15;
  1249.   deleteObject    * = 16;
  1250.   renameObject    * = 17;
  1251.   moreCache       * = 18;
  1252.   copyDir         * = 19;
  1253.   waitChar        * = 20;
  1254.   setProtect      * = 21;
  1255.   createDir       * = 22;
  1256.   examineObject   * = 23;
  1257.   examineNext     * = 24;
  1258.   diskInfo        * = 25;
  1259.   info            * = 26;
  1260.   flush           * = 27;
  1261.   setComment      * = 28;
  1262.   parent          * = 29;
  1263.   timer           * = 30;
  1264.   inhibit         * = 31;
  1265.   diskType        * = 32;
  1266.   diskChange      * = 33;
  1267.   setDate         * = 34;
  1268.  
  1269.   screenMode      * = 994;
  1270.  
  1271.   readReturn      * = 1001;
  1272.   writeReturn     * = 1002;
  1273.   seek            * = 1008;
  1274.   findUpdate      * = 1004;
  1275.   findInput       * = 1005;
  1276.   findOutput      * = 1006;
  1277.   actionEnd       * = 1007;
  1278.   setFileSize     * = 1022;    (* fast file system only in 1.3 *)
  1279.   writeprotect    * = 1023;    (* fast file system only in 1.3 *)
  1280.  
  1281. (* new 2.0 packets *)
  1282.   sameLock       * = 40;
  1283.   changeSignal   * = 995;
  1284.   format         * = 1020;
  1285.   makeLink       * = 1021;
  1286.  
  1287.   readLink       * = 1024;
  1288.   fhFromLock     * = 1026;
  1289.   isFileSystem   * = 1027;
  1290.   changeMode     * = 1028;
  1291.  
  1292.   copyDirFH      * = 1030;
  1293.   parentFH       * = 1031;
  1294.   examineAll     * = 1033;
  1295.   examineFH      * = 1034;
  1296.  
  1297.   lockRecord     * = 2008;
  1298.   freeRecord     * = 2009;
  1299.  
  1300.   addNotify      * = 4097;
  1301.   removeNotify   * = 4098;
  1302.  
  1303. (* Added in V39: *)
  1304.   examineAllEnd  * = 1035;
  1305.   setOwner       * = 1036;
  1306.  
  1307. (* Tell a file system to serialize the current volume. This is typically
  1308.  * done by changing the creation date of the disk. This packet does not take
  1309.  * any arguments.  NOTE: be prepared to handle failure of this packet for
  1310.  * V37 ROM filesystems.
  1311.  *)
  1312.   serializeDisk  * = 4200;
  1313.  
  1314. TYPE
  1315.  
  1316. (*
  1317.  * A structure for holding error messages - stored as array with error = 0
  1318.  * for the last entry.
  1319.  *)
  1320.   ErrorString* = RECORD
  1321.     nums   * : e.APTR;
  1322.     strings* : e.APTR;
  1323.   END; (* ErrorString *)
  1324.  
  1325. (* DOS library node structure.
  1326.  * This is the data at positive offsets from the library node.
  1327.  * Negative offsets from the node is the jump table to DOS functions
  1328.  * node = OpenLibrary( "dos.library" .. )      *)
  1329.  
  1330.   DosLibrary* = RECORD (e.LibraryBase)
  1331.     lib         * : e.Library;
  1332.     root        * : RootNodePtr;      (* Pointer to RootNode, described below *)
  1333.     gv          * : e.APTR;           (* Pointer to BCPL global vector        *)
  1334.     a2            : LONGINT;          (* BCPL standard register values        *)
  1335.     a5            : LONGINT;
  1336.     a6            : LONGINT;
  1337.     errors      * : ErrorStringPtr;   (* PRIVATE pointer to array of error msgs *)
  1338.     timeReq       : t.TimeRequestPtr; (* PRIVATE pointer to timer request *)
  1339.     utilityBase   : e.LibraryPtr;     (* PRIVATE ptr to utility library *)
  1340.     intuitionBase : e.LibraryPtr      (* PRIVATE ptr to intuition library *)
  1341.   END; (* DosLibrary *)
  1342.  
  1343.   TaskArray* = RECORD
  1344.     maxCLI * : LONGINT;
  1345.     cli    * : ARRAY 32767 OF ProcessId;
  1346.   END; (* TaskArray *)
  1347.  
  1348.   RootNode* = RECORD
  1349.     taskArray     * : TaskArrayPtr; (* [0] is max number of CLI's
  1350.                                      * [1] is APTR to process id of CLI 1
  1351.                                      * [n] is APTR to process id of CLI n *)
  1352.     consoleSegment* : e.BPTR;         (* SegList for the CLI                      *)
  1353.     time          * : Date;         (* Current time                        *)
  1354.     restartSeg    * : e.BPTR;         (* SegList for the disk validator process   *)
  1355.     info          * : DosInfoPtr;   (* Pointer to the Info structure            *)
  1356.     fileHandlerSegment* : e.BPTR;     (* segment for a file handler               *)
  1357.     cliList       * : e.MinList;    (* new list of all CLI processes *)
  1358.                                     (* the first cplArray is also rnTaskArray   *)
  1359.     bootProc      * : ProcessId;    (* private ptr to msgport of boot fs        *)
  1360.     shellSegment  * : e.BPTR;         (* seglist for Shell (for NewShell)         *)
  1361.     flags         * : s.SET32;      (* dos flags *)
  1362.   END; (* RootNode *)
  1363.  
  1364. CONST
  1365.  
  1366.   wildStar   * = 24;
  1367.   private1     = 1;       (* private for dos *)
  1368.  
  1369. TYPE
  1370.  
  1371. (* ONLY to be allocated by DOS! *)
  1372.   CliProcList* = RECORD (e.MinNodeBase)
  1373.     node * : e.MinNode;
  1374.     first* : LONGINT;    (* number of first entry in array *)
  1375.     array* : POINTER TO ARRAY 32767 OF ProcessId;
  1376.                          (* [0] is max number of CLI's in this entry (n)
  1377.                           * [1] is CPTR to process id of CLI cplFirst
  1378.                           * [n] is CPTR to process id of CLI cplFirst+n-1
  1379.                           *)
  1380.   END; (* CliProcList *)
  1381.  
  1382.   DosInfo* = RECORD
  1383.     mcName    * : e.BPTR;       (* PRIVATE: system resident module list      *)
  1384.     devInfo   * : DevInfoPtr; (* Device List                               *)
  1385.     devices   * : e.BPTR;     (* Currently zero                            *)
  1386.     handlers  * : e.BPTR;     (* Currently zero                            *)
  1387.     netHand   * : ProcessId;  (* Network handler processid; currently zero *)
  1388.     devLock   * : e.SignalSemaphore; (* do NOT access directly! *)
  1389.     entryLock * : e.SignalSemaphore; (* do NOT access directly! *)
  1390.     deleteLock* : e.SignalSemaphore; (* do NOT access directly! *)
  1391.   END; (* DosInfo *)  (* DosInfo *)
  1392.  
  1393. (* structure for the Dos resident list.  Do NOT allocate these, use       *)
  1394. (* AddSegment(), and heed the warnings in the autodocs!                   *)
  1395.  
  1396.   Segment* = RECORD
  1397.     next* : e.BPTR;
  1398.     uc  * : LONGINT;
  1399.     seg * : e.BPTR;
  1400.     name* : ARRAY 4 OF CHAR; (* actually the first 4 chars of BSTR name *)
  1401.   END; (* Segment *)
  1402.  
  1403. CONST
  1404.  
  1405.   cmdSystem     * = -1;
  1406.   cmdInternal   * = -2;
  1407.   cmdDisabled   * = -999;
  1408.  
  1409. TYPE
  1410.  
  1411.   PathLockPtr * = POINTER TO PathLock;
  1412.   PathLock * = RECORD
  1413.     next * : PathLockPtr;
  1414.     lock * : FileLockPtr;
  1415.   END; (* PathLock *)
  1416.  
  1417.  
  1418. (* DOS Processes started from the CLI via RUN or NEWCLI have this additional
  1419.  * set to data associated with them *)
  1420.  
  1421.   CommandLineInterface* = RECORD
  1422.     result2       * : LONGINT;       (* Value of IoErr from last command        *)
  1423.     setName       * : BSTR;          (* Name of current directory               *)
  1424.     commandDir    * : PathLockPtr;   (* Head of the path locklist               *)
  1425.     returnCode    * : LONGINT;       (* Return code from last command           *)
  1426.     commandName   * : BSTR;          (* Name of current command                 *)
  1427.     failLevel     * : LONGINT;       (* Fail level (set by FAILAT)              *)
  1428.     prompt        * : BSTR;          (* Current prompt (set by PROMPT)          *)
  1429.     standardInput * : FileHandlePtr; (* Default (terminal) CLI input            *)
  1430.     currentInput  * : FileHandlePtr; (* Current CLI input                       *)
  1431.     commandFile   * : BSTR;          (* Name of EXECUTE command file            *)
  1432.     interactive   * : LONGINT;       (* Boolean; True if prompts required       *)
  1433.     background    * : LONGINT;       (* Boolean; True if CLI created by RUN     *)
  1434.     currentOutput * : FileHandlePtr; (* Current CLI output                      *)
  1435.     defaultStack  * : LONGINT;       (* Stack size to be obtained in long words *)
  1436.     standardOutput* : FileHandlePtr; (* Default (terminal) CLI output           *)
  1437.     module        * : e.BPTR;          (* SegList of currently loaded command     *)
  1438.   END; (* CommandLineInterface *)
  1439.   CommandLineInterfaceAPtr* = POINTER TO CommandLineInterface;
  1440.  
  1441. (* This structure can take on different values depending on whether it is
  1442.  * a device, an assigned directory, or a volume.  Below is the structure
  1443.  * reflecting volumes only.  Following that is the structure representing
  1444.  * only devices. Following that is the unioned structure representing all
  1445.  * the values
  1446.  *)
  1447.  
  1448.   DosListNode * = RECORD END;
  1449.  
  1450. (* structure representing a volume *)
  1451.  
  1452.   DeviceList* = RECORD (DosListNode)
  1453.     next      * : DeviceListPtr; (* bptr to next device list *)
  1454.     type      * : LONGINT;       (* see DLT below *)
  1455.     task      * : ProcessId;     (* ptr to handler task *)
  1456.     lock      * : FileLockPtr;   (* not for volumes *)
  1457.     volumeDate* : Date;          (* creation date *)
  1458.     lockList  * : FileLockPtr;   (* outstanding locks *)
  1459.     diskType  * : LONGINT;       (* 'DOS', etc *)
  1460.     unused    * : LONGINT;
  1461.     name      * : BSTR;          (* bptr to bcpl name *)
  1462.   END; (* DeviceList *)
  1463.   DeviceListAPtr*           = POINTER TO DeviceList;
  1464.  
  1465. (* device structure (same as the DeviceNode structure in filehandler.h) *)
  1466.  
  1467.   DevInfo* = RECORD (DosListNode)
  1468.     next     * : DevInfoPtr;
  1469.     type     * : LONGINT;
  1470.     task     * : ProcessId;
  1471.     lock     * : FileLockPtr;
  1472.     handler  * : BSTR;
  1473.     stackSize* : LONGINT;
  1474.     priority * : LONGINT;
  1475.     startup  * : FileSysStartupMsgPtr;
  1476.     segList  * : e.BPTR;
  1477.     globVec  * : e.BPTR;
  1478.     name     * : BSTR;
  1479.   END; (* DevInfo *)
  1480.   DevInfoAPtr*              = POINTER TO DevInfo;
  1481.  
  1482. (* structure used for multi-directory assigns. AllocVec()ed. *)
  1483.  
  1484.   AssignList* = RECORD
  1485.     next* : AssignListPtr;
  1486.     lock* : FileLockPtr;
  1487.   END; (* AssignList *)
  1488.  
  1489. (* combined structure for devices, assigned directories, volumes *)
  1490.  
  1491.   DosList* = RECORD (DosListNode)
  1492.     next      * : DevInfoPtr;      (* bptr to next device on list *)
  1493.     type      * : LONGINT;         (* see DLT below *)
  1494.     task      * : ProcessId;       (* ptr to handler task *)
  1495.     lock      * : FileLockPtr;
  1496.     assignName* : e.LSTRPTR;       (* name for non-or-late-binding assign *)
  1497.     list      * : AssignListPtr;   (* for multi-directory assigns (regular) *)
  1498.     unused    * : ARRAY 4 OF LONGINT;
  1499.  
  1500.     name      * : BSTR;            (* bptr to bcpl name *)
  1501.   END; (* DosList *)
  1502.   DosListAPtr*              = POINTER TO DosList;
  1503.  
  1504. CONST
  1505.  
  1506. (* definitions for DosList.type *)
  1507.   device     * = 0;
  1508.   directory  * = 1;       (* assign *)
  1509.   volume     * = 2;
  1510.   late       * = 3;       (* late-binding assign *)
  1511.   nonBinding * = 4;       (* non-binding assign *)
  1512.   private    * = -1;      (* for internal use only *)
  1513.  
  1514. TYPE
  1515.  
  1516. (* structure return by GetDeviceProc() *)
  1517.   DevProc* = RECORD
  1518.     port   * : e.MsgPortPtr;
  1519.     lock   * : FileLockPtr;
  1520.     flags  * : s.SET32;
  1521.     devNode  : DosListNodePtr;    (* DON'T TOUCH OR USE! *)
  1522.   END; (* DevProc *)
  1523.  
  1524. CONST
  1525.  
  1526. (* definitions for DevProc.flags *)
  1527.   unLock    * = 0;
  1528.   assign    * = 1;
  1529.  
  1530. (* Flags to be passed to LockDosList(), etc *)
  1531.   devices    * = 2;
  1532.   volumes    * = 3;
  1533.   assigns    * = 4;
  1534.   entry      * = 5;
  1535.   ldDelete   * = 6;
  1536.  
  1537. (* you MUST specify one of read or write *)
  1538.   dosListRead  * = 0;
  1539.   dosListWrite * = 1;
  1540.  
  1541. (* actually all but ldEntry (which is used for internal locking) *)
  1542.   all        * = {devices, volumes, assigns};
  1543.  
  1544. TYPE
  1545.  
  1546. (* a lock structure, as returned by Lock() or DupLock() *)
  1547.   FileLock* = RECORD
  1548.     link  * : FileLockPtr;     (* bcpl pointer to next lock *)
  1549.     key   * : LONGINT;         (* disk block number *)
  1550.     access* : LONGINT;         (* exclusive or shared *)
  1551.     task  * : ProcessId;       (* handler task's port *)
  1552.     volume* : DeviceListPtr;   (* bptr to dltVOLUME DosList entry *)
  1553.   END; (* FileLock *)
  1554.  
  1555. CONST
  1556.  
  1557. (* error report types for ErrorReport() *)
  1558.   reportStream          * = 0;       (* a stream *)
  1559.   reportTask            * = 1;       (* a process - unused *)
  1560.   reportLock            * = 2;       (* a lock *)
  1561.   reportVolume          * = 3;       (* a volume node *)
  1562.   reportInsert          * = 4;       (* please insert volume *)
  1563.  
  1564. (* Special error codes for ErrorReport() *)
  1565.   diskError             * = 296;     (* Read/write error *)
  1566.   abortBusy             * = 288;     (* You MUST replace... *)
  1567.  
  1568. (* types for initial packets to shells from run/newcli/execute/system. *)
  1569. (* For shell-writers only *)
  1570.   runExecute            * = -1;
  1571.   runSystem             * = -2;
  1572.   runSystemAsynch       * = -3;
  1573.  
  1574. (* Types for fibDirEntryType.  NOTE that both USERDIR and ROOT are      *)
  1575. (* directories, and that directory/file checks should use <0 and >=0.    *)
  1576. (* This is not necessarily exhaustive!  Some handlers may use other      *)
  1577. (* values as needed, though <0 and >=0 should remain as supported as     *)
  1578. (* possible.                                                             *)
  1579.   root        * = 1;
  1580.   userDir     * = 2;
  1581.   softLink    * = 3;       (* looks like dir, but may point to a file! *)
  1582.   linkDir     * = 4;       (* hard link to dir *)
  1583.   file        * = -3;      (* must be negative for FIB! *)
  1584.   linkFile    * = -4;      (* hard link to file *)
  1585.   pipeFile    * = -5;      (* for pipes that(s}pport ExamineFH *)
  1586.  
  1587. (*
  1588. **      $VER: stdio.h 36.6 (1.11.91)
  1589. **
  1590. **      ANSI-like stdio defines for dos buffered I/O
  1591. *)
  1592.  
  1593. CONST
  1594.  
  1595. (* types for SetVBuf *)
  1596.   bufLine * = 0;                (* flush on \n, etc *)
  1597.   bufFull * = 1;                (* never flush except when needed *)
  1598.   bufNone * = 2;                (* no buffering *)
  1599.  
  1600. (* EOF return value *)
  1601.   endStreamCh * = -1;
  1602.  
  1603.  
  1604. (**-- Library Base variable --------------------------------------------*)
  1605.  
  1606. VAR
  1607.  
  1608.   base* : DosLibraryPtr;
  1609.  
  1610.  
  1611. (**-- Library Functions ------------------------------------------------*)
  1612.  
  1613. TYPE
  1614.   OwnerInfo * = RECORD (* dummy for better access on SetOwner etc.*)
  1615.     uid *: INTEGER;
  1616.     gid *: INTEGER;
  1617.   END;
  1618.  
  1619. (*
  1620. **      $VER: dos_protos.h 36.31 (17.12.92)
  1621. *)
  1622.  
  1623.  
  1624. PROCEDURE Open* [base,-30]
  1625.   ( name       [1] : ARRAY OF CHAR;
  1626.     accessMode [2] : LONGINT)
  1627.   : FileHandlePtr;
  1628. PROCEDURE Close* [base,-36]
  1629.   ( file [1] : FileHandlePtr )
  1630.   : BOOLEAN;
  1631. PROCEDURE OldClose* [base,-36]
  1632.   ( file [1] : FileHandlePtr );
  1633. PROCEDURE Read* [base,-42]
  1634.   ( file       [1] : FileHandlePtr;
  1635.     VAR buffer [2] : ARRAY OF SYS.BYTE;
  1636.     length     [3] : LONGINT)
  1637.   : LONGINT;
  1638. PROCEDURE Write* [base,-48]
  1639.   ( file   [1] : FileHandlePtr;
  1640.     buffer [2] : ARRAY OF SYS.BYTE;
  1641.     length [3] : LONGINT)
  1642.   : LONGINT;
  1643. PROCEDURE Input* [base,-54] ()
  1644.   : FileHandlePtr;
  1645. PROCEDURE Output* [base,-60] ()
  1646.   : FileHandlePtr;
  1647. PROCEDURE Seek* [base,-66]
  1648.   ( file     [1] : FileHandlePtr;
  1649.     position [2] : LONGINT;
  1650.     offset   [3] : LONGINT)
  1651.   : LONGINT;
  1652. PROCEDURE DeleteFile* [base,-72]
  1653.   ( name [1] : ARRAY OF CHAR )
  1654.   : BOOLEAN;
  1655. PROCEDURE Rename* [base,-78]
  1656.   ( oldName [1] : ARRAY OF CHAR;
  1657.     newName [2] : ARRAY OF CHAR )
  1658.   : BOOLEAN;
  1659. PROCEDURE Lock* [base,-84]
  1660.   ( name [1] : ARRAY OF CHAR;
  1661.     type [2] : LONGINT)
  1662.   : FileLockPtr;
  1663. PROCEDURE UnLock* [base,-90]
  1664.   ( lock [1] : FileLockPtr );
  1665. PROCEDURE DupLock* [base,-96]
  1666.   ( lock [1] : FileLockPtr )
  1667.   : FileLockPtr;
  1668. PROCEDURE Examine* [base,-102]
  1669.   ( lock    [1] : FileLockPtr;
  1670.     VAR fib [2] : FileInfoBlock )
  1671.   : BOOLEAN;
  1672. PROCEDURE ExNext* [base,-108]
  1673.   ( lock    [1] : FileLockPtr;
  1674.     VAR fib [2] : FileInfoBlock )
  1675.   : BOOLEAN;
  1676. PROCEDURE Info* [base,-114]
  1677.   ( lock     [1] : FileLockPtr;
  1678.     VAR info [2] : InfoData )
  1679.   : BOOLEAN;
  1680. PROCEDURE CreateDir* [base,-120]
  1681.   ( name [1] : ARRAY OF CHAR )
  1682.   : FileLockPtr;
  1683. PROCEDURE CurrentDir* [base,-126]
  1684.   ( lock [1] : FileLockPtr )
  1685.   : FileLockPtr;
  1686. PROCEDURE IoErr* [base,-132] ()
  1687.   : LONGINT;
  1688. PROCEDURE CreateProc* [base,-138]
  1689.   ( name      [1] : ARRAY OF CHAR;
  1690.     pri       [2] : LONGINT;
  1691.     segList   [3] : e.BPTR;
  1692.     stackSize [4] : LONGINT)
  1693.   : ProcessId;
  1694. PROCEDURE Exit* [base,-144]
  1695.   ( returnCode [1] : LONGINT);
  1696. PROCEDURE LoadSeg* [base,-150]
  1697.   ( name [1] : ARRAY OF CHAR )
  1698.   : e.BPTR;
  1699. PROCEDURE UnLoadSeg* [base,-156]
  1700.   ( seglist [1] : e.BPTR );
  1701. PROCEDURE DeviceProc* [base,-174]
  1702.   ( name [1] : ARRAY OF CHAR )
  1703.   : ProcessId;
  1704. PROCEDURE SetComment* [base,-180]
  1705.   ( name    [1] : ARRAY OF CHAR;
  1706.     comment [2] : ARRAY OF CHAR )
  1707.   : BOOLEAN;
  1708. PROCEDURE SetProtection* [base,-186]
  1709.   ( name    [1] : ARRAY OF CHAR;
  1710.     protect [2] : s.SET32)
  1711.   : BOOLEAN;
  1712. PROCEDURE DateStamp* [base,-192]
  1713.   ( VAR date [1] : DateBase );
  1714. PROCEDURE Delay* [base,-198]
  1715.   ( timeout [1] : e.ULONG);
  1716. PROCEDURE WaitForChar* [base,-204]
  1717.   ( file    [1] : FileHandlePtr;
  1718.     timeout [2] : LONGINT)
  1719.   : BOOLEAN;
  1720. PROCEDURE ParentDir* [base,-210]
  1721.   ( lock [1] : FileLockPtr )
  1722.   : FileLockPtr;
  1723. PROCEDURE IsInteractive* [base,-216]
  1724.   ( file [1] : FileHandlePtr )
  1725.   : BOOLEAN;
  1726. PROCEDURE Execute* [base,-222]
  1727.   ( string [1] : ARRAY OF CHAR;
  1728.     file   [2] : FileHandlePtr;
  1729.     file2  [3] : FileHandlePtr )
  1730.   : BOOLEAN;
  1731.  
  1732. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  1733.  
  1734. (*      DOS Object creation/deletion *)
  1735.  
  1736. PROCEDURE AllocDosObject* [base,-228]
  1737.   ( type [1] : e.ULONG;
  1738.     tags [2] : ARRAY OF u.TagItem )
  1739.   : e.APTR;
  1740. PROCEDURE AllocDosObjectTags* [base,-228]
  1741.   ( type [1]   : e.ULONG;
  1742.     tags [2].. : u.Tag )
  1743.   : e.APTR;
  1744. PROCEDURE FreeDosObject* [base,-234]
  1745.   ( type [1] : e.ULONG;
  1746.     ptr  [2] : e.APTR );
  1747.  
  1748. (*      Packet Level routines *)
  1749.  
  1750. PROCEDURE DoPkt* [base,-240]
  1751.   ( port   [1] : ProcessId;
  1752.     action [2] : LONGINT;
  1753.     arg1   [3] : LONGINT;
  1754.     arg2   [4] : LONGINT;
  1755.     arg3   [5] : LONGINT;
  1756.     arg4   [6] : LONGINT;
  1757.     arg5   [7] : LONGINT)
  1758.   : LONGINT;
  1759. PROCEDURE DoPkt0* [base,-240]
  1760.   ( port   [1] : ProcessId;
  1761.     action [2] : LONGINT)
  1762.   : LONGINT;
  1763. PROCEDURE DoPkt1* [base,-240]
  1764.   ( port   [1] : ProcessId;
  1765.     action [2] : LONGINT;
  1766.     arg1   [3] : LONGINT)
  1767.   : LONGINT;
  1768. PROCEDURE DoPkt2* [base,-240]
  1769.   ( port   [1] : ProcessId;
  1770.     action [2] : LONGINT;
  1771.     arg1   [3] : LONGINT;
  1772.     arg2   [4] : LONGINT)
  1773.   : LONGINT;
  1774. PROCEDURE DoPkt3* [base,-240]
  1775.   ( port   [1] : ProcessId;
  1776.     action [2] : LONGINT;
  1777.     arg1   [3] : LONGINT;
  1778.     arg2   [4] : LONGINT;
  1779.     arg3   [5] : LONGINT)
  1780.   : LONGINT;
  1781. PROCEDURE DoPkt4* [base,-240]
  1782.   ( port   [1] : ProcessId;
  1783.     action [2] : LONGINT;
  1784.     arg1   [3] : LONGINT;
  1785.     arg2   [4] : LONGINT;
  1786.     arg3   [5] : LONGINT;
  1787.     arg4   [6] : LONGINT)
  1788.   : LONGINT;
  1789. PROCEDURE SendPkt* [base,-246]
  1790.   ( VAR dp    [1] : DosPacket;
  1791.     port      [2] : ProcessId;
  1792.     replyport [3] : e.MsgPortPtr );
  1793. PROCEDURE WaitPkt* [base,-252] ()
  1794.   : DosPacketPtr;
  1795. PROCEDURE ReplyPkt* [base,-258]
  1796.   ( dp   [1] : DosPacketPtr;
  1797.     res1 [2] : LONGINT;
  1798.     res2 [3] : LONGINT);
  1799. PROCEDURE AbortPkt* [base,-264]
  1800.   ( port [1] : ProcessId;
  1801.     pkt  [2] : DosPacketPtr );
  1802.  
  1803. (*      Record Locking *)
  1804.  
  1805. PROCEDURE LockRecord* [base,-270]
  1806.   ( fh      [1] : FileHandlePtr;
  1807.     offset  [2] : e.ULONG;
  1808.     length  [3] : e.ULONG;
  1809.     mode    [4] : e.ULONG;
  1810.     timeout [5] : e.ULONG )
  1811.   : BOOLEAN;
  1812. PROCEDURE LockRecords* [base,-276]
  1813.   ( recArray [1] : RecordLockPtr;
  1814.     timeout  [2] : e.ULONG )
  1815.   : BOOLEAN;
  1816. PROCEDURE UnLockRecord* [base,-282]
  1817.   ( fh     [1] : FileHandlePtr;
  1818.     offset [2] : e.ULONG;
  1819.     length [3] : e.ULONG )
  1820.   : BOOLEAN;
  1821. PROCEDURE UnLockRecords* [base,-288]
  1822.   ( recArray [1] : RecordLockPtr )
  1823.   : BOOLEAN;
  1824.  
  1825. (*      Buffered File I/O *)
  1826.  
  1827. PROCEDURE SelectInput* [base,-294]
  1828.   ( fh [1] : FileHandlePtr )
  1829.   : FileHandlePtr;
  1830. PROCEDURE SelectOutput* [base,-300]
  1831.   ( fh [1] : FileHandlePtr )
  1832.   : FileHandlePtr;
  1833. PROCEDURE FGetC* [base,-306]
  1834.   ( fh [1] : FileHandlePtr )
  1835.   : LONGINT;
  1836. PROCEDURE FPutC* [base,-312]
  1837.   ( fh [1] : FileHandlePtr;
  1838.     ch [2] : LONGINT )
  1839.   : LONGINT;
  1840. PROCEDURE UnGetC* [base,-318]
  1841.   ( fh        [1] : FileHandlePtr;
  1842.     character [2] : LONGINT)
  1843.   : LONGINT;
  1844. PROCEDURE FRead* [base,-324]
  1845.   ( fh        [1] : FileHandlePtr;
  1846.     VAR block [2] : ARRAY OF SYS.BYTE;
  1847.     blocklen  [3] : e.ULONG;
  1848.     number    [4] : e.ULONG )
  1849.   : LONGINT;
  1850. PROCEDURE FWrite* [base,-330]
  1851.   ( fh       [1] : FileHandlePtr;
  1852.     block    [2] : ARRAY OF SYS.BYTE;
  1853.     blocklen [3] : e.ULONG;
  1854.     number   [4] : e.ULONG )
  1855.   : LONGINT;
  1856. PROCEDURE FGets* [base,-336]
  1857.   ( fh      [1] : FileHandlePtr;
  1858.     VAR buf [2] : ARRAY OF CHAR;
  1859.     buflen  [3] : e.ULONG )
  1860.   : e.APTR;
  1861. PROCEDURE FPuts* [base,-342]
  1862.   ( fh  [1] : FileHandlePtr;
  1863.     str [2] : ARRAY OF CHAR )
  1864.   : BOOLEAN;
  1865. PROCEDURE VFWritef* [base,-348]
  1866.   ( fh     [1] : FileHandlePtr;
  1867.     format [2] : ARRAY OF CHAR;
  1868.     argv   [3] : ARRAY OF SYS.BYTE )
  1869.   : LONGINT;
  1870. PROCEDURE FWritef* [base,-348]
  1871.   ( fh     [1]   : FileHandlePtr;
  1872.     format [2]   : ARRAY OF CHAR;
  1873.     argv   [3].. : SYS.LONGWORD )
  1874.   : LONGINT;
  1875. PROCEDURE VFPrintf* [base,-354]
  1876.   ( fh     [1] : FileHandlePtr;
  1877.     format [2] : ARRAY OF CHAR;
  1878.     argv   [3] : ARRAY OF SYS.LONGWORD )
  1879.   : LONGINT;
  1880. PROCEDURE FPrintf* [base,-354]
  1881.   ( fh     [1]   : FileHandlePtr;
  1882.     format [2]   : ARRAY OF CHAR;
  1883.     argv   [3].. : SYS.LONGWORD )
  1884.   : LONGINT;
  1885. PROCEDURE Flush* [base,-360]
  1886.   ( fh [1] : FileHandlePtr )
  1887.   : BOOLEAN;
  1888. PROCEDURE SetVBuf* [base,-366]
  1889.   ( fh       [1] : FileHandlePtr;
  1890.     VAR buff [2] : ARRAY OF CHAR;
  1891.     type     [3] : LONGINT;
  1892.     size     [4] : LONGINT)
  1893.   : LONGINT;
  1894. PROCEDURE SetVBufPtr* [base,-366]
  1895.   ( fh   [1] : FileHandlePtr;
  1896.     buff [2] : e.LSTRPTR;
  1897.     type [3] : LONGINT;
  1898.     size [4] : LONGINT)
  1899.   : LONGINT;
  1900.  
  1901. (*     DOS Object Management *)
  1902.  
  1903. PROCEDURE DupLockFromFH* [base,-372]
  1904.   ( fh [1] : FileHandlePtr )
  1905.   : FileLockPtr;
  1906. PROCEDURE OpenFromLock* [base,-378]
  1907.   ( lock [1] : FileLockPtr )
  1908.   : FileHandlePtr;
  1909. PROCEDURE ParentOfFH* [base,-384]
  1910.   ( fh [1] : FileHandlePtr )
  1911.   : FileLockPtr;
  1912. PROCEDURE ExamineFH* [base,-390]
  1913.   ( fh      [1] : FileHandlePtr;
  1914.     VAR fib [2] : FileInfoBlock )
  1915.   : BOOLEAN;
  1916. PROCEDURE SetFileDate* [base,-396]
  1917.   ( name     [1] : ARRAY OF CHAR;
  1918.     VAR date [2] : DateBase )
  1919.   : BOOLEAN;
  1920. PROCEDURE NameFromLock* [base,-402]
  1921.   ( lock       [1] : FileLockPtr;
  1922.     VAR buffer [2] : ARRAY OF CHAR;
  1923.     len        [3] : LONGINT)
  1924.   : BOOLEAN;
  1925. PROCEDURE NameFromFH* [base,-408]
  1926.   ( fh         [1] : FileHandlePtr;
  1927.     VAR buffer [2] : ARRAY OF CHAR;
  1928.     len        [3] : LONGINT)
  1929.   : BOOLEAN;
  1930. PROCEDURE SplitName* [base,-414]
  1931.   ( name      [1] : ARRAY OF CHAR;
  1932.     seperator [2] : CHAR;
  1933.     VAR buf   [3] : ARRAY OF CHAR;
  1934.     oldpos    [4] : LONGINT;
  1935.     size      [5] : LONGINT)
  1936.   : INTEGER;
  1937. PROCEDURE SameLock* [base,-420]
  1938.   ( lock1 [1] : FileLockPtr;
  1939.     lock2 [2] : FileLockPtr )
  1940.   : INTEGER;
  1941. PROCEDURE SetMode* [base,-426]
  1942.   ( fh   [1] : FileHandlePtr;
  1943.     mode [2] : LONGINT)
  1944.   : BOOLEAN;
  1945. PROCEDURE ExAll* [base,-432]
  1946.   ( lock    [1] : FileLockPtr;
  1947.     buffer  [2] : ARRAY OF SYS.BYTE;
  1948.     size    [3] : LONGINT;
  1949.     data    [4] : LONGINT;
  1950.     control [5] : ExAllControlPtr )
  1951.   : BOOLEAN;
  1952. PROCEDURE ReadLink* [base,-438]
  1953.   ( port       [1] : ProcessId;
  1954.     lock       [2] : FileLockPtr;
  1955.     path       [3] : ARRAY OF CHAR;
  1956.     VAR buffer [4] : ARRAY OF CHAR;
  1957.     size       [5] : e.ULONG )
  1958.   : LONGINT;
  1959. PROCEDURE MakeLink* [base,-444]
  1960.   ( name [1] : ARRAY OF CHAR;
  1961.     dest [2] : LONGINT;
  1962.     soft [3] : LONGINT)
  1963.   : LONGINT;
  1964. PROCEDURE ChangeMode* [base,-450]
  1965.   ( type    [1] : LONGINT; (* must be changeFH *)
  1966.     fh      [2] : FileHandlePtr;
  1967.     newmode [3] : LONGINT)
  1968.   : BOOLEAN;
  1969. PROCEDURE ChangeModeLock* [base,-450]
  1970.   ( type    [1] : LONGINT; (* must be changeLock *)
  1971.     fh      [2] : FileLockPtr;
  1972.     newmode [3] : LONGINT)
  1973.   : BOOLEAN;
  1974. PROCEDURE SetFileSize* [base,-456]
  1975.   ( fh   [1] : FileHandlePtr;
  1976.     pos  [2] : LONGINT;
  1977.     mode [3] : LONGINT)
  1978.   : LONGINT;
  1979.  
  1980. (*      Error Handling *)
  1981.  
  1982. PROCEDURE SetIoErr* [base,-462]
  1983.   ( result [1] : LONGINT)
  1984.   : LONGINT;
  1985. PROCEDURE Fault* [base,-468]
  1986.   ( code       [1] : LONGINT;
  1987.     header     [2] : ARRAY OF CHAR;
  1988.     VAR buffer [3] : ARRAY OF CHAR;
  1989.     len        [4] : LONGINT)
  1990.   : LONGINT;
  1991. PROCEDURE PrintFault* [base,-474]
  1992.   ( code   [1] : LONGINT;
  1993.     header [2] : ARRAY OF CHAR )
  1994.   : BOOLEAN;
  1995. PROCEDURE ErrorReport* [base,-480]
  1996.   ( code   [1] : LONGINT;
  1997.     type   [2] : LONGINT;
  1998.     arg1   [3] : DeviceListAPtr;
  1999.     device [8] : ProcessId )
  2000.   : LONGINT;
  2001. PROCEDURE ErrorReportLock* [base,-480]
  2002.   ( code   [1] : LONGINT;
  2003.     type   [2] : LONGINT;
  2004.     arg1   [3] : FileLockPtr;
  2005.     device [8] : ProcessId )
  2006.   : LONGINT;
  2007. PROCEDURE ErrorReportFH* [base,-480]
  2008.   ( code   [1] : LONGINT;
  2009.     type   [2] : LONGINT;
  2010.     arg1   [3] : FileHandlePtr;
  2011.     device [8] : ProcessId )
  2012.   : LONGINT;
  2013. PROCEDURE Requester* [base,-486]
  2014.   ( s1    [1] : ARRAY OF CHAR;
  2015.     s2    [2] : ARRAY OF CHAR;
  2016.     s3    [3] : ARRAY OF CHAR;
  2017.     flags [4] : s.SET32 )
  2018.   : LONGINT;
  2019.  
  2020. (*      Process Management *)
  2021.  
  2022. PROCEDURE Cli* [base,-492] ()
  2023.   : CommandLineInterfaceAPtr;
  2024. PROCEDURE CreateNewProc* [base,-498]
  2025.   ( tags [1] : ARRAY OF u.TagItem )
  2026.   : ProcessPtr;
  2027. PROCEDURE CreateNewProcTags* [base,-498]
  2028.   ( tags [1].. : u.Tag )
  2029.   : ProcessPtr;
  2030. PROCEDURE RunCommand* [base,-504]
  2031.   ( seg      [1] : e.BPTR;
  2032.     stack    [2] : LONGINT;
  2033.     paramptr [3] : ARRAY OF CHAR;
  2034.     paramlen [4] : LONGINT)
  2035.   : LONGINT;
  2036. PROCEDURE GetConsoleTask* [base,-510] ()
  2037.   : ProcessId;
  2038. PROCEDURE SetConsoleTask* [base,-516]
  2039.   ( task [1] : ProcessId )
  2040.   : ProcessId;
  2041. PROCEDURE GetFileSysTask* [base,-522] ()
  2042.   : ProcessId;
  2043. PROCEDURE SetFileSysTask* [base,-528]
  2044.   ( task [1] : ProcessId )
  2045.   : ProcessId;
  2046. PROCEDURE GetArgStr* [base,-534] ()
  2047.   : e.LSTRPTR;
  2048. PROCEDURE SetArgStr* [base,-540]
  2049.   ( string [1] : ARRAY OF CHAR )
  2050.   : e.LSTRPTR;
  2051. PROCEDURE FindCliProc* [base,-546]
  2052.   ( num [1] : e.ULONG )
  2053.   : ProcessPtr;
  2054. PROCEDURE MaxCli* [base,-552] ()
  2055.   : e.ULONG;
  2056. PROCEDURE SetCurrentDirName* [base,-558]
  2057.   ( name [1] : ARRAY OF CHAR )
  2058.   : BOOLEAN;
  2059. PROCEDURE GetCurrentDirName* [base,-564]
  2060.   ( VAR buf [1] : ARRAY OF CHAR;
  2061.     len     [2] : LONGINT)
  2062.   : BOOLEAN;
  2063. PROCEDURE SetProgramName* [base,-570]
  2064.   ( name [1] : ARRAY OF CHAR )
  2065.   : BOOLEAN;
  2066. PROCEDURE GetProgramName* [base,-576]
  2067.   ( VAR buf [1] : ARRAY OF CHAR;
  2068.     len     [2] : LONGINT)
  2069.   : BOOLEAN;
  2070. PROCEDURE SetPrompt* [base,-582]
  2071.   ( name [1] : ARRAY OF CHAR )
  2072.   : BOOLEAN;
  2073. PROCEDURE GetPrompt* [base,-588]
  2074.   ( VAR buf [1] : ARRAY OF CHAR;
  2075.     len     [2] : LONGINT)
  2076.   : BOOLEAN;
  2077. PROCEDURE SetProgramDir* [base,-594]
  2078.   ( lock [1] : FileLockPtr )
  2079.   : FileLockPtr;
  2080. PROCEDURE GetProgramDir* [base,-600] ()
  2081.   : FileLockPtr;
  2082.  
  2083. (*      Device List Management *)
  2084.  
  2085. PROCEDURE System* [base,-606]
  2086.   ( command [1] : ARRAY OF CHAR;
  2087.     tags    [2] : ARRAY OF u.TagItem )
  2088.   : LONGINT;
  2089. PROCEDURE SystemTags* [base,-606]
  2090.   ( command [1]   : ARRAY OF CHAR;
  2091.     tags    [2].. : u.Tag )
  2092.   : LONGINT;
  2093. PROCEDURE AssignLock* [base,-612]
  2094.   ( name [1] : ARRAY OF CHAR;
  2095.     lock [2] : FileLockPtr )
  2096.   : BOOLEAN;
  2097. PROCEDURE AssignLate* [base,-618]
  2098.   ( name [1] : ARRAY OF CHAR;
  2099.     path [2] : ARRAY OF CHAR )
  2100.   : BOOLEAN;
  2101. PROCEDURE AssignPath* [base,-624]
  2102.   ( name [1] : ARRAY OF CHAR;
  2103.     path [2] : ARRAY OF CHAR )
  2104.   : BOOLEAN;
  2105. PROCEDURE AssignAdd* [base,-630]
  2106.   ( name [1] : ARRAY OF CHAR;
  2107.     lock [2] : FileLockPtr )
  2108.   : BOOLEAN;
  2109. PROCEDURE RemAssignList* [base,-636]
  2110.   ( name [1] : ARRAY OF CHAR;
  2111.     lock [2] : FileLockPtr )
  2112.   : LONGINT;
  2113. PROCEDURE GetDeviceProc* [base,-642]
  2114.   ( name [1] : ARRAY OF CHAR;
  2115.     dp   [2] : DevProcPtr )
  2116.   : DevProcPtr;
  2117. PROCEDURE FreeDeviceProc* [base,-648]
  2118.   ( dp [1] : DevProcPtr );
  2119. PROCEDURE LockDosList* [base,-654]
  2120.   ( flags [1] : s.SET32 )
  2121.   : DosListNodePtr;
  2122. PROCEDURE UnLockDosList* [base,-660]
  2123.   ( flags [1] : s.SET32 );
  2124. PROCEDURE AttemptLockDosList* [base,-666]
  2125.   ( flags [1] : s.SET32 )
  2126.   : DosListNodePtr;
  2127. PROCEDURE RemDosEntry* [base,-672]
  2128.   ( dlist [1] : DosListNodePtr )
  2129.   : BOOLEAN;
  2130. PROCEDURE AddDosEntry* [base,-678]
  2131.   ( dlist [1] : DosListNodePtr )
  2132.   : DosListNodePtr;
  2133. PROCEDURE FindDosEntry* [base,-684]
  2134.   ( dlist [1] : DosListNodePtr;
  2135.     name  [2] : ARRAY OF CHAR;
  2136.     flags [3] : s.SET32 )
  2137.   : DosListNodePtr;
  2138. PROCEDURE NextDosEntry* [base,-690]
  2139.   ( dlist [1] : DosListNodePtr;
  2140.     flags [2] : s.SET32 )
  2141.   : DosListNodePtr;
  2142. PROCEDURE MakeDosEntry* [base,-696]
  2143.   ( name [1] : ARRAY OF CHAR;
  2144.     type [2] : LONGINT)
  2145.   : DosListNodePtr;
  2146. PROCEDURE FreeDosEntry* [base,-702]
  2147.   ( dlist [1] : DosListNodePtr );
  2148. PROCEDURE IsFileSystem* [base,-708]
  2149.   ( name [1] : ARRAY OF CHAR )
  2150.   : BOOLEAN;
  2151.  
  2152. (*      Handler Interface *)
  2153.  
  2154. PROCEDURE Format* [base,-714]
  2155.   ( filesystem [1] : ARRAY OF CHAR;
  2156.     volumename [2] : ARRAY OF CHAR;
  2157.     dostype    [3] : e.ULONG )
  2158.   : BOOLEAN;
  2159. PROCEDURE Relabel* [base,-720]
  2160.   ( drive   [1] : ARRAY OF CHAR;
  2161.     newname [2] : ARRAY OF CHAR )
  2162.   : BOOLEAN;
  2163. PROCEDURE Inhibit* [base,-726]
  2164.   ( name  [1] : ARRAY OF CHAR;
  2165.     onoff [2] : LONGINT)
  2166.   : BOOLEAN;
  2167. PROCEDURE AddBuffers* [base,-732]
  2168.   ( name   [1] : ARRAY OF CHAR;
  2169.     number [2] : LONGINT)
  2170.   : BOOLEAN;
  2171.  
  2172. (*      Date, Time Routines *)
  2173.  
  2174. PROCEDURE CompareDates* [base,-738]
  2175.   ( VAR date1 [1] : DateBase;
  2176.     VAR date2 [2] : DateBase )
  2177.   : LONGINT;
  2178. PROCEDURE DateToStr* [base,-744]
  2179.   ( VAR datetime [1] : DateTime )
  2180.   : BOOLEAN;
  2181. PROCEDURE StrToDate* [base,-750]
  2182.   ( VAR datetime [1] : DateTime )
  2183.   : BOOLEAN;
  2184.  
  2185. (*      Image Management *)
  2186.  
  2187. PROCEDURE InternalLoadSeg* [base,-756]
  2188.   ( fh         [1] : FileHandlePtr;
  2189.     table      [8] : e.BPTR;
  2190.     funcarray  [9] : e.APTR;
  2191.     VAR stack [10] : LONGINT )
  2192.   : e.BPTR;
  2193. PROCEDURE InternalUnLoadSeg* [base,-762]
  2194.   ( seglist  [1] : e.BPTR;
  2195.     freefunc [9] : e.PROC )
  2196.   : BOOLEAN;
  2197. PROCEDURE NewLoadSeg* [base,-768]
  2198.   ( file [1] : ARRAY OF CHAR;
  2199.     tags [2] : ARRAY OF u.TagItem )
  2200.   : e.BPTR;
  2201. PROCEDURE NewLoadSegTags* [base,-768]
  2202.   ( file [1]   : ARRAY OF CHAR;
  2203.     tags [2].. : u.Tag )
  2204.   : e.BPTR;
  2205. PROCEDURE AddSegment* [base,-774]
  2206.   ( name   [1] : ARRAY OF CHAR;
  2207.     seg    [2] : e.BPTR;
  2208.     system [3] : LONGINT)
  2209.   : BOOLEAN;
  2210. PROCEDURE FindSegment* [base,-780]
  2211.   ( name   [1] : ARRAY OF CHAR;
  2212.     seg    [2] : SegmentPtr;
  2213.     system [3] : LONGINT)
  2214.   : SegmentPtr;
  2215. PROCEDURE RemSegment* [base,-786]
  2216.   ( seg [1] : SegmentPtr )
  2217.   : BOOLEAN;
  2218.  
  2219. (*      Command Support *)
  2220.  
  2221. PROCEDURE CheckSignal* [base,-792]
  2222.   ( mask [1] : s.SET32)
  2223.   : s.SET32;
  2224. PROCEDURE OldReadArgs* [base,-798]
  2225.   ( template  [1] : ARRAY OF CHAR;
  2226.     VAR array [2] : ARRAY OF SYS.BYTE;
  2227.     args      [3] : RDArgsPtr )
  2228.   : RDArgsPtr;
  2229. PROCEDURE ReadArgs* [base,-798]
  2230.   ( template  [1] : ARRAY OF CHAR;
  2231.     VAR array [2] : ArgsStruct;
  2232.     args      [3] : RDArgsPtr )
  2233.   : RDArgsPtr;
  2234. PROCEDURE FindArg* [base,-804]
  2235.   ( template [1] : ARRAY OF CHAR;
  2236.     keyword  [2] : ARRAY OF CHAR )
  2237.   : LONGINT;
  2238. PROCEDURE ReadItem* [base,-810]
  2239.   ( VAR name [1] : ARRAY OF CHAR;
  2240.     maxchars [2] : LONGINT;
  2241.     cSource  [3] : CSourcePtr )
  2242.   : LONGINT;
  2243. PROCEDURE StrToLong* [base,-816]
  2244.   ( string    [1] : ARRAY OF CHAR;
  2245.     VAR value [2] : LONGINT )
  2246.   : LONGINT;
  2247. PROCEDURE MatchFirst* [base,-822]
  2248.   ( pat        [1] : ARRAY OF CHAR;
  2249.     VAR anchor [2] : AnchorPath )
  2250.   : LONGINT;
  2251. PROCEDURE MatchNext* [base,-828]
  2252.   ( VAR anchor [1] : AnchorPath )
  2253.   : LONGINT;
  2254. PROCEDURE MatchEnd* [base,-834]
  2255.   ( VAR anchor [1] : AnchorPath );
  2256. PROCEDURE ParsePattern* [base,-840]
  2257.   ( pat     [1] : ARRAY OF CHAR;
  2258.     VAR buf [2] : ARRAY OF CHAR;
  2259.     buflen  [3] : LONGINT)
  2260.   : INTEGER;
  2261. PROCEDURE MatchPattern* [base,-846]
  2262.   ( pat [1] : ARRAY OF CHAR;
  2263.     str [2] : ARRAY OF CHAR )
  2264.   : BOOLEAN;
  2265. PROCEDURE FreeArgs* [base,-858]
  2266.   ( args [1] : RDArgsPtr );
  2267. PROCEDURE FilePart* [base,-870]
  2268.   ( path [1] : ARRAY OF CHAR )
  2269.   : e.LSTRPTR;
  2270. PROCEDURE PathPart* [base,-876]
  2271.   ( path [1] : ARRAY OF CHAR )
  2272.   : e.LSTRPTR;
  2273. PROCEDURE AddPart* [base,-882]
  2274.   ( VAR dirname [1] : ARRAY OF CHAR;
  2275.     filename    [2] : ARRAY OF CHAR;
  2276.     size        [3] : e.ULONG )
  2277.   : BOOLEAN;
  2278.  
  2279. (*      Notification *)
  2280.  
  2281. PROCEDURE StartNotify* [base,-888]
  2282.   ( VAR notify [1] : NotifyRequest )
  2283.   : BOOLEAN;
  2284. PROCEDURE EndNotify* [base,-894]
  2285.   ( VAR notify [1] : NotifyRequest );
  2286.  
  2287. (*      Environment Variable functions *)
  2288.  
  2289. PROCEDURE SetVar* [base,-900]
  2290.   ( name       [1] : ARRAY OF CHAR;
  2291.     VAR buffer [2] : ARRAY OF CHAR;
  2292.     size       [3] : LONGINT;
  2293.     flags      [4] : s.SET32)
  2294.   : BOOLEAN;
  2295. PROCEDURE GetVar* [base,-906]
  2296.   ( name       [1] : ARRAY OF CHAR;
  2297.     VAR buffer [2] : ARRAY OF CHAR;
  2298.     size       [3] : LONGINT;
  2299.     flags      [4] : s.SET32)
  2300.   : LONGINT;
  2301. PROCEDURE DeleteVar* [base,-912]
  2302.   ( name  [1] : ARRAY OF CHAR;
  2303.     flags [2] : s.SET32 )
  2304.   : BOOLEAN;
  2305. PROCEDURE FindVar* [base,-918]
  2306.   ( name [1] : ARRAY OF CHAR;
  2307.     type [2] : s.SET32 )
  2308.   : LocalVarPtr;
  2309. PROCEDURE CliInit* [base,-924]
  2310.   ( VAR dp [8] : DosPacket )
  2311.   : s.SET32;
  2312. PROCEDURE CliInitNewcli* [base,-930]
  2313.   ( VAR dp [8] : DosPacket )
  2314.   : s.SET32;
  2315. PROCEDURE CliInitRun* [base,-936]
  2316.   ( VAR dp [8] : DosPacket )
  2317.   : s.SET32;
  2318. PROCEDURE WriteChars* [base,-942]
  2319.   ( buf    [1] : ARRAY OF CHAR;
  2320.     buflen [2] : LONGINT )
  2321.   : LONGINT;
  2322. PROCEDURE PutStr* [base,-948]
  2323.   ( str [1] : ARRAY OF CHAR )
  2324.   : LONGINT;
  2325. PROCEDURE VPrintf* [base,-954]
  2326.   ( format   [1] : ARRAY OF CHAR;
  2327.     argarray [2] : ARRAY OF SYS.BYTE )
  2328.   : LONGINT;
  2329. PROCEDURE Printf* [base,-954]
  2330.   ( format   [1]   : ARRAY OF CHAR;
  2331.     argarray [2].. : SYS.LONGWORD )
  2332.   : LONGINT;
  2333. PROCEDURE PrintF* [base,-954]
  2334.   ( format   [1]   : ARRAY OF CHAR;
  2335.     argarray [2].. : SYS.LONGWORD );
  2336.  
  2337. (* these were unimplemented until dos 36.147 *)
  2338.  
  2339. PROCEDURE ParsePatternNoCase* [base,-966]
  2340.   ( pat     [1] : ARRAY OF CHAR;
  2341.     VAR buf [2] : ARRAY OF CHAR;
  2342.     buflen  [3] : LONGINT)
  2343.   : INTEGER;
  2344. PROCEDURE MatchPatternNoCase* [base,-972]
  2345.   ( pat [1] : ARRAY OF CHAR;
  2346.     str [2] : ARRAY OF CHAR )
  2347.   : BOOLEAN;
  2348.  
  2349. (* this was added for V37 dos; returned 0 before then. *)
  2350.  
  2351. PROCEDURE SameDevice* [base,-984]
  2352.   ( lock1 [1] : FileLockPtr;
  2353.     lock2 [2] : FileLockPtr )
  2354.   : BOOLEAN;
  2355.  
  2356. (* NOTE: the following entries did NOT exist before ks 36.303 (2.02) *)
  2357. (* If you are going to use them, open dos.library with version 37 *)
  2358.  
  2359. (* These calls were added for V39 dos: *)
  2360. PROCEDURE ExAllEnd* [base,-990]
  2361.   ( lock    [1] : FileLockPtr;
  2362.     buffer  [2] : ARRAY OF SYS.BYTE;
  2363.     size    [3] : LONGINT;
  2364.     data    [4] : LONGINT;
  2365.     control [5] : ExAllControlPtr );
  2366. PROCEDURE SetOwner* [base,-996]
  2367.   ( name      [1] : ARRAY OF CHAR;
  2368.     ownerInfo [2] : OwnerInfo)
  2369.   : BOOLEAN;
  2370.  
  2371.  
  2372. (**-- C Macros ---------------------------------------------------------*)
  2373.  
  2374. (*
  2375. **      $VER: stdio.h 36.6 (1.11.91)
  2376. **
  2377. **      ANSI-like stdio defines for dos buffered I/O
  2378. *)
  2379.  
  2380.  
  2381. PROCEDURE [0] ReadChar * () : CHAR;
  2382.   VAR c : LONGINT;
  2383. BEGIN
  2384.   c := FGetC (Input());
  2385.   IF (c < 0) OR (c > 255) THEN c := 0 END;
  2386.   RETURN CHR(c)
  2387. END ReadChar;
  2388.  
  2389. PROCEDURE [0] WriteChar * ( c : CHAR ) : LONGINT;
  2390. BEGIN
  2391.   RETURN FPutC (Output (), ORD (c))
  2392. END WriteChar;
  2393.  
  2394. PROCEDURE [0] UnReadChar * ( c : CHAR ) : LONGINT;
  2395. BEGIN
  2396.   RETURN UnGetC (Input(), ORD(c))
  2397. END UnReadChar;
  2398.  
  2399. (* next one is inefficient *)
  2400.  
  2401. PROCEDURE [0] ReadChars *
  2402.   (VAR buf : ARRAY OF SYS.BYTE; num : LONGINT)
  2403.   : LONGINT;
  2404. BEGIN
  2405.   RETURN FRead (Input (), buf, 1, num)
  2406. END ReadChars;
  2407.  
  2408. PROCEDURE [0] ReadLn * (VAR buf : ARRAY OF CHAR; len : LONGINT) : e.APTR;
  2409. BEGIN
  2410.   RETURN FGets (Input (), buf, len)
  2411. END ReadLn;
  2412.  
  2413. PROCEDURE [0] WriteStr * (s : ARRAY OF CHAR) : BOOLEAN;
  2414. <*$CopyArrays-*>
  2415. BEGIN
  2416.   RETURN FPuts (Output (), s)
  2417. END WriteStr;
  2418.  
  2419. PROCEDURE [0] VWritef *
  2420.   (format : ARRAY OF CHAR; argv : ARRAY OF SYS.BYTE)
  2421.   : LONGINT;
  2422. <*$CopyArrays-*>
  2423. BEGIN
  2424.   RETURN VFWritef (Output(), format, argv)
  2425. END VWritef;
  2426.  
  2427. (*
  2428.  * Use this to convert a ProcessId (eg. WBStartup.process) to a ProcessPtr.
  2429.  *)
  2430. PROCEDURE [0] ProcessIdToProcess*(id: ProcessId): ProcessPtr;
  2431. BEGIN
  2432.   RETURN SYS.VAL(ProcessPtr,SYS.VAL(LONGINT,id)-SIZE(e.Task))
  2433. END ProcessIdToProcess;
  2434.  
  2435. (*
  2436.  * Use this to get a Process' ProcessId, ie. a pointer to its MsgPort.
  2437.  *)
  2438. PROCEDURE [0] ProcessToProcessId*(proc: ProcessPtr): ProcessId;
  2439. BEGIN
  2440.   RETURN SYS.ADR(proc.msgPort);
  2441. END ProcessToProcessId;
  2442.  
  2443. (**-- Library Base variable --------------------------------------------*)
  2444.  
  2445. <*$LongVars-*>
  2446.  
  2447. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  2448.  
  2449. BEGIN (* CloseLib *)
  2450.   IF base # NIL THEN e.CloseLibrary (base) END;
  2451. END CloseLib;
  2452.  
  2453. BEGIN (* Dos *)
  2454.   base := SYS.VAL (DosLibraryPtr,
  2455.                    e.OpenLibrary (dosName, e.libraryMinimum));
  2456.   IF base = NIL THEN HALT (100) END;
  2457.   Kernel.SetCleanup (CloseLib)
  2458. END Dos.
  2459.